Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

2 votes
1 answer
402 views

How to load content into a LazyColumn asynchronously (Jetpack Compose)?

In my Jetpack Compose Android application I'm trying to load content asynchronously into a LazyColumn. I see the titles of the movies displayed in the console (see println in the ...
emptify's user avatar
  • 21
1 vote
1 answer
173 views

Kotlin throws NullPointerException, pointing not to code but to funcion name, when reading data with Datastore and Gson

In my mobile app, written with Kotlin and Android Jetpack Compose, I am saving some user data from web service to DataStore. For user data I have UserModel data class, it's content is not important ...
PiotrW's user avatar
  • 120
0 votes
2 answers
460 views

Change Background color of SnackBar in LaunchedEffect (Jetpack Compose)

I am trying to pass message from viewModel into my Screen Activity using collect in Android Jetpack compose, where I am trying to show snackbar but for some reason it is not changing background color ...
user366584's user avatar
  • 1,046
0 votes
0 answers
23 views

Strange behaviour observed in suspend-wrapped callback

I've created the following to wrap the callback convention found in the Stripe Kotlin/Java SDK: suspend fun Terminal.discoverReaders(stripeTerminalConfiguration: DiscoveryConfiguration): List<...
Alexander Trauzzi's user avatar
0 votes
3 answers
3k views

How to wait to finish task in kotlin

I have a function like this internal fun handleResponse(items: List<TestItem>? = null) { viewModelScope.launch(Dispatchers.IO) { val isDataReturned = testItems != null if (...
Vivek Modi's user avatar
  • 6,129
0 votes
2 answers
2k views

Android kotlin flows collects initial values when visible

I was trying out different kinds of flows like flows with channel, sharedflows and stateflows. What I did was, suppose I have a MainActivity, inside it I have two buttons side by side at the top and ...
abby's user avatar
  • 400
0 votes
0 answers
197 views

Pagin v3 - loses state when clicking on list item and come back - jetpack compose

I am displaying a paginated list using paging library in a lazy column in a bottom nav bar with 4 tabs say HomeScreen. When its item is clicked it will to next activity with normal intent . But when i ...
Harish Padmanabh's user avatar
0 votes
0 answers
160 views

Single vs multiple ViewModels in Android Jetpack

I have this situation where view renders data from Android ViewModel(s) but functionally they are distinct. One could be showing, say, some financial data and the other one sports-related. One ...
rysv's user avatar
  • 3,068
0 votes
1 answer
790 views

Using Jetpack WindowManager to calculate screen size on Android

As Display methods are deprecated in Android 12, I am planning to use Jetpack's backward compatible WindowManager library succeeding Display. However I am not sure whether I face an issue if I ...
Egemen Hamutçu's user avatar
1 vote
2 answers
3k views

Koltin Flow flatMapLatest to combineTransform Using Multiple StateFlows

I have the below working code which uses a dropdown to update the satusFilterFlow to allow for the filtering of characters through the getCharacterList call. The getCharacterList call uses the jetpack ...
Steve Bergamini's user avatar
0 votes
1 answer
284 views

How to use Repository data in two different fragments

I have FragmentA and FragmentAViewModel. FragmentAViewModel calls RepositoryA for getContactData(), which is a silent call without blocking the UI. Now User Navigate to FragmentB which has ...
Yogesh Byndoor's user avatar
6 votes
2 answers
1k views

replace GlobalScope.launch in jetpack compose

I am writing some pager code in jetpack compose and came to a situation where I need to change page number by button click. This is my event on button click: onClick = {pagerState.scrollToPage(page=...
Ankit Shah's user avatar
  • 1,277
2 votes
1 answer
525 views

"@Composable invocations can only happen from the context of a @Composable function"

@Composable fun CategorySection(context: Context) { Column(modifier = Modifier.padding(8.dp)) { Text( text = "Api Data", style = MaterialTheme.typography....
Josue Muleshi's user avatar
1 vote
1 answer
852 views

view doesn't get recomposes when mutable list changes

I have an application that has a statelist in the viewmodel. and i have function that adds a number in the list. when i click on a button, it adds the number in the list. but the changes is not ...
Venkataramanan's user avatar
7 votes
3 answers
6k views

How to handle Kotlin Jetpack Paging 3 exceptions?

I am new to kotlin and jetpack, I am requested to handle errors (exceptions) coming from the PagingData, I am not allowed to use Flow, I am only allowed to use LiveData. This is the Repository: ...
Roy Hayek's user avatar

15 30 50 per page