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.
android-jetpack
422
questions
314
votes
10
answers
207k
views
What is AndroidX?
I am reading about a room library of Android. I see they changed package android to androidx. I did not understand that. Can someone explain, please?
implementation "androidx.room:room-runtime:$...
35
votes
2
answers
55k
views
Android Jetpack Compose width / height / size modifier vs requiredWidth / requiredHeight / requiredSize
Android Jetpack Compose contains width(), height() and size() layout modifiers as well as requiredWidth(), requiredHeight() and requiredSize(). What is the difference between these two sets of ...
41
votes
5
answers
24k
views
Jetpack Compose - Order of Modifiers
Documentation says that Modifiers are applied from the left.
But from this example it looks like they are applied from the right:
First border and then padding because there is no space between text ...
118
votes
15
answers
173k
views
Can I use library that used android support with Androidx projects.
I know, androidx and support dependency causing multidex error
We can not use androidx and android support at a same time. So I totally migrate to androidx. but one of my dependency lib used android ...
88
votes
3
answers
64k
views
Android. Is WorkManager running when app is closed?
I want to schedule nightly database updates. So I use new Android WorkManager. My understanding is that once scheduled it will always run in the background independently from the app's lifecycle.
Is ...
46
votes
12
answers
36k
views
Jetpack Compose collapsing toolbar
I can't find any documents on the matter, is there something similar to a CollapsingToolbar in Compose?
All I found was a mention of it here, but nothing on how to set it up
170
votes
38
answers
143k
views
Android Navigation Architecture Component - Get current visible fragment
Before trying the Navigation component I used to manually do fragment transactions and used the fragment tag in order to fetch the current fragment.
val fragment:MyFragment = supportFragmentManager....
155
votes
32
answers
230k
views
Handling back button in Android Navigation Component
I'd like to know how properly handle system back button action using Navigation Controller. In my app I have two fragments (for ex. fragment1 and fragment2) and I have an action in fragment1 with ...
125
votes
9
answers
49k
views
Fragments destroyed / recreated with Jetpack's Android Navigation components
I'm trying to implement Navigation with Jetpack's architecture components in my existing app.
I have a single activity app where the main fragment (ListFragment) is a list of items. Currently, when ...
8
votes
3
answers
14k
views
Different types of width in jetpack compose
I am working in textfield in jetpack compose. I want to build something like this
TextField(
value = value,
onValueChange = {
value = it
},
...
101
votes
3
answers
52k
views
When should I use Android Jetpack Compose's Surface composable?
There's a Surface composable in Jetpack Compose which represents a material surface. A surface allows you to set up things like background color or border but it seems that the same might be done ...
65
votes
5
answers
103k
views
Error: "@Composable invocations can only happen from the context of a @Composable function"
I'm trying to show a toast message when clicking on a toolbar action, but I got this error
@composable invocations can only happen from the context of a
@composable function
Code:
@Composable
fun ...
33
votes
5
answers
41k
views
Android Jetpack Compose mutableStateListOf not doing Recomposition
So, I have a mutableStateListOf in viewModel:
var childTravellersList = mutableStateListOf<TravellersDetails>()
TravellersDetails is a data class having a field called error.
this ...
21
votes
5
answers
20k
views
How to schedule notifications using WorkManager?
I want to schedule a notification everytime the user add a note in the database for a specific time. While there are multiple ways to do it using AlarmManager, BroadcastReceiver etc. How can it be ...
65
votes
1
answer
42k
views
Android Work Manager vs Services?
In my Android app i have multiple intent services which run one after another and the very first intent service is trigerred by a broadcast. I came across Work Manager a few days ago and really liked ...