Questions tagged [android-jetpack]
Android Jetpack is a Google's set of libraries, tools and architectural guidance to build Android apps and provides common infrastructure code.
2,247
questions
0
votes
0
answers
14
views
Jetpack Nav-Graph navigation to current fragment itself also having it in stack
Fragment Structure
Fragment Stack I want so that on back press I load fragment with my old data state
A->B->C->C
Fragment Stack, nav graph created even if I move from C to C again. (that is ...
-1
votes
1
answer
26
views
Compose's "AndroidView"'s factory method doesn't recall when "remember" value change
I've an AndroidView on my UI and I'm creating a custom view class using factory scope. And I've remember value above my android view which is changing by user actions.
val isActive = remember { ...
1
vote
1
answer
26
views
How to start the same action multiple times from the same startingDestination using navigation graph?
I started recently using the navigation graph and i have a problem that i havent solved yet. I want to open the same fragment multiple times that they are stacked on each other. I already figured out ...
-1
votes
0
answers
19
views
Jetpack Compose Place every question in it's own screen
I have a JSON data looking like this
questions: [
{
id: "1",
question_type: "FREE_TEXT",
answer_type: "SINGLE_LINE_TEXT",
question_text: "what's your name?",
...
0
votes
0
answers
30
views
Sending an ID or an object as String to the next screen in Jetpack Compose?
I have 30 users displayed in a LazyColumn. On user click, I navigate forward to UserDetailsScreen. My question, is it better to pass the ID of the user and create another database (Room) call inside ...
1
vote
1
answer
18
views
Android function is absent but exist in documentation
There is a function addWeakLoadStateListener() in the documentation, but is absent in my build.
I have latest version of page 2.
https://developer.android.com/reference/androidx/paging/PagedList#...
0
votes
1
answer
53
views
How to add/remove characters inside TextField?
I have a Room database with a table that holds users. Each user has an ID and a name. My goal is to change the name of the user based on the ID. Here is what I have tried.
I have an UsersScreen that ...
1
vote
1
answer
22
views
Do enqueueUniquePeriodicWork() Work Manager's method works in a Composable Function?
I'm trying to start a periodic task.
The problem is that I need some data to be send to the work manager and this data is only accessible when the user signs in or signs up to my app (those data are ...
1
vote
1
answer
26
views
Jetpack Compose: Content color of TabRow
In my app, I am using TabRow, that has two tabs:
I do set the content color with
TabRow(
...
contentColor = Color.Black,
...
)
While "ACTIVE" is really displayed in black, I also ...
-2
votes
0
answers
36
views
How many viewModels per screen in jetpack compose [closed]
Suppose I have a base screen for handling login flow. This base screen will have child full screen components for handling flow parts like phone number screen, otp verification screen, account details ...
0
votes
0
answers
26
views
Navigation component with BottomNavigationView
I am trying to get started with using the Android navigation component architecture along with a BottomNavigationView. As a simplified example, I have a Fragment called MainFragment with a button, ...
0
votes
1
answer
39
views
UI doesn't update when mutableStateOf changes
I have @Composable item - ThumbButton and Text which displays current likes number. When I click button I want to increment likes number. I don't know why it doesn't work
val likesCounter = remember { ...
4
votes
1
answer
138
views
Do I still need to use traditional way to implement Preferences Settings Screen in Jetpack Compose?
At present I use Jetpack Compose in my Android Studio project.
I find many projects still to use traditional way to implement a Preferences Settings Screen after I Google it.
I hope to implement a ...
0
votes
1
answer
46
views
How fix remember in Jetpack Compose?
The picture shows the code and logs
For some reason
startDate and endDate not recreated
0
votes
0
answers
14
views
Jetpack Compose - A Card is inside a Surface Composable - Card size is ignored with Surface Composable being fillMaxSize [duplicate]
I am new to Jetpack Compose, and just starting.
I came across this code
This is a Composable function creating a Circle using Card
@Composable
fun CreateCircle() {
Card(
modifier = ...
0
votes
1
answer
37
views
How to handle Fragment to not load again when coming from another fragment in Navigation Component in Android?
Scenario: I have 2 fragments ProductList and ProductDetail in my nav graph. And when i click on any product it opens the ProductDetail fragment using findNavController.navigate() method.
Problem: The ...
1
vote
0
answers
56
views
Jetpack compose IntrinsicSize.Min cuts off Text - want to force Text to take up exact height and minimum width required for that height
I have a Text component that I want the width to expand as big as it wants to accommodate the supplied text and to be exactly 2 lines tall.
I have attempted to implement this by calculating the height ...
0
votes
0
answers
18
views
Is it possible to make the label attribute flexible in Navigation Component?
<fragment
android:id="@+id/navigationMain_fragment_profileFragment"
android:name="com.test.fragments.ProfileFragment"
android:label="luq281"
tools:...
0
votes
0
answers
25
views
How to change state due to action on a different composable
I'd like to appologise first, I'm trying to follow the MRE guidline, but, since it's my first time doing it, I might not ommiited enough code to make it as simple as possible, I will try to get better ...
0
votes
0
answers
19
views
Paging3 bounces back when jumping at the bottom and returning
Just show as the gif. paging3 bounces back when jumping at the bottom and returning.
What should I do?
0
votes
0
answers
37
views
Is there a way to share relationship between composable objects?
Maybe it's a dumb question, but I was wondering... is there a way to have relationship between composable objects?
If I have a Box() and I want to be sure that it's zIndex is the highest, hence, I ...
-1
votes
2
answers
30
views
OutlinedTextField Autofocus
So I have a compose layout let suppose A which has a text and a see more option. When clicking on it it should navigate to another compose where you can see the remaining text.
So there is edit option ...
-1
votes
0
answers
69
views
How can I scan only the rectangle area with Camerax?
I am making a barcode reader with Jetpack compose and zxing library. I just want to have the rectangle area analyzed. Anyone have an idea about this?
0
votes
0
answers
18
views
how to set onClickListener on words of string in a textField in compose UI
Actually I'm developing an social-media app where I want that my user can mention more than one user in between of their compliment string just like in Instagram comment section...
on which if ...
0
votes
0
answers
39
views
How to hide IntelliJ/Android studio Compose code/split/design bar?
The code/split/design bar takes a full code line of height, but I never use it.
In an Android project it is also visible for non Compose .kt files, which is completely unnecessary.
Is there a way to ...
0
votes
0
answers
34
views
Save states between screens with BottomNavBar - Jetpac Compose
As the title suggests - I want to save the states of screen elements. That is, I want to switch something on screen A, go to screen B, return to screen A and have all the changes in screen A saved. I ...
0
votes
0
answers
31
views
Is using AndroidX classes in ViewModel and Repository classes viable in a Clean Architecture Kotlin-Multiplatform Project?
I don't have a multiplatform application right now but I'd like to structure it in a way that would make it easy to turn it into one.
I have a Fragment/View which can use all Androidx/Android classes.
...
0
votes
0
answers
12
views
How does Paging 3.0 data caching differ from caching data from network in the Room database?
As far as I know, one of the uses of Paging3 is to cache the data from the xxxPagingSource. Does it mean I don't have to cache my network calls anymore?
In-memory caching for your paged data. This ...
0
votes
1
answer
86
views
How do I expand the full height of a lazy column in Jetpack Compose?
I have a Lazy column like so
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.height(gridMultiple(i = 15) * data.size)
.padding(vertical = gridMultiple(i = 2)),
...
1
vote
1
answer
22
views
adjustable width of a surface to be able to put cards next to one another
Thinking of a way to deal cards at the bottom of the screen, I know I need to calculate to offset so that the cards will be set next to one another.
is there a way to have a trigger to when I deal a ...
0
votes
0
answers
15
views
How to call resultLauncher that exists in the activity from a composable function?
I'm trying to implement One-Tap together with Jetpack Compose. The startDestination in my NavGraph is a screen called AuthScreen. Inside the ativity I have defined a launcher like this:
class ...
0
votes
1
answer
49
views
ModalBottomSheet is showing above BottomBar in Jetpack Compose
I have BottomBar added in ComposeActivity. BottomBar is responsible for showing 3 composable. I don't want to add ModalBottomSheet to Activity instead I have added ModalBottomSheet inside 3rd Screen ...
0
votes
0
answers
16
views
One image atop another while maitaining correct size and position in Jetpack Compose?
first image
second image
desired result
I figured out how to do it in XML using guidelines, but now im switching to jetpack and have a hard time. Here's what I did in XML:
<androidx....
1
vote
1
answer
56
views
NoClassDefFoundError: Failed resolution of: Landroidx/tracing/Trace
When I start a basic androidTest my app crashes:
@Test
fun myTest() {
val scenario = ActivityScenario.launch(MainActivity::class.java)
// ...
}
This is the stacktrace:
2022-04-27 08:43:38....
0
votes
0
answers
12
views
Data Persistence between Google Play updates
I want to keep some user preferences locally so not to needlessly call a server with that information. I want this data to persist between Google Play updates. It has been shown here that ...
-1
votes
0
answers
15
views
(Data)Binding view after setContentView
I am extending a class which is the one in charge of inflating the view by using the standard setContentView(layoutId) method. The thing is that I would like to get a DataBinding object from this ...
0
votes
1
answer
52
views
onClick trigger for change color of multiple buttons. JetpackCompose
I have 7 buttons in a row. each has a transparent background. I want to click on one of them and its color will change. I press again and it will come back. the same with the rest of the buttons. If ...
0
votes
1
answer
49
views
How ViewModel retains data?
How can viewModel retains data due to configuration changes but not when we try to re instantiate the activity.
ViewModel objects are scoped to the Lifecycle passed to the ViewModelProvider when ...
0
votes
0
answers
18
views
When does OnItemActivatedListener.onItemActivated gets triggered in RecyclerView?
The documentation for OnItemActivatedListener.onItemActivated says that this method is
Called when an item is "activated". An item is activated, for example, when no selection exists and ...
0
votes
0
answers
54
views
How to get Material color swatches with Jetpack Compose Color?
Is there a way to get Material Color swatches with Jetpack Compose Colors?
Created Material 500 colors manually using this website, and this material color picker site.
val Red500 = Color(0xfff44336)
...
0
votes
0
answers
34
views
Jetpack compose file manager transition
I have a composable in my app that can render the contents of a directory:
EntriesListing(
directoryListing,
renderUpButton = uiState.value.directory != Path.Empty,
...
1
vote
0
answers
53
views
Missing material icons in Android Jetpack Compose
implementation "androidx.compose.material:material-icons-extended:$compose_version" is included on my build.graddle file with the latest stable realease of Compose (1.1.1).
However, I am ...
0
votes
0
answers
12
views
What's the point of PublishSubject.onNext(Unit)?
Following PublishSubject is created:
val disposeUsage = remember { PublishSubject.create<Unit>() }
and immediately used as (a):
DisposableEffect(Unit) {
onDispose {
disposeUsage....
0
votes
1
answer
121
views
@Composable funck. into onClick event - Jetpack Compose
I try show AlertDialog when press a button.
For AlertDialog i have a composable function - showDialog.
It is clear that this function calls a dialog.
I have another composable function which displays ...
0
votes
1
answer
27
views
How to map PagingSource to another object
I implement paging 3 follow this codelab. codelab
But when i create UserPagingRepository, i have problem that data class is not map. In Room DataBase, i use UserLocal otherhand i use UserRemote for ...
0
votes
2
answers
71
views
How to fill row nested in lazycolumn. JetpacCompose
I make my own and very simple calendar.
Problem: I'm trying to display values from a list. There are seven values in one line. Each new line continues the list.
Below is an example of invalid code....
0
votes
1
answer
55
views
How to update Jetpack compose UI by override method or outside the function
I am converting my older XML UI as per requirement.
in there,
I am unable to update by Jetpack compose UI by my override function.
In some research I see many websites shows remember function helps ...
0
votes
1
answer
79
views
Composable not recomposing when ViewModel updated from a different Composable
I am developing an Android app using Jetpack Compose. The app shows a list of items.
It also has a top bar containing a search bar.
We have 3 composable: the list of items, the search bar component, ...
0
votes
1
answer
65
views
How can i select only one grid in jetpack compose?
var iconSize by remember { mutableStateOf(50.dp)}
var boxBorder by remember { mutableStateOf(1.dp)}
LazyVerticalGrid(
columns = GridCells.Fixed(3),
content = {
...
0
votes
2
answers
21
views
Room.databaseBuilder not running in Android Jetpack
I'm learning how to implement Room from Android jetpack into my android studio app but a message saying "not enough information to infer type variable T" keeps showing up when I try to use ...