Skip to main content

All Questions

0 votes
2 answers
76 views

Android Jetpack Compose: How to stop execution of a coroutine launched in `produceState`?

Goal I have a computation heavy function calculateItems: suspend (String) -> Sequence<String>. I want to load the outputs of this calculation while showing the progress to the user and ...
Gamer2015's user avatar
  • 291
0 votes
1 answer
105 views

How to update UI state using stateIn in ViewModel jetpack compose

I have a ProfileViewModel where I load the user profile when the user lands on the screen. To achieve this, I use stateIn so that the profile is fetched automatically. Now, I want to modify ...
Vivek Modi's user avatar
  • 7,495
1 vote
0 answers
39 views

Is it really necessary to use a flow when signing in Firebase?

I have an operation to sign in Firebase: suspend fun signIn(user: String, pass: String): Response<Unit> And I call this signIn in the ViewModel like this: class AuthViewModel @Inject ...
Always Learner's user avatar
0 votes
2 answers
75 views

Trigger a coroutine when the other is finished

I do have an app where I have to call an endpoint to pull a list of product and another endpoint to pull the list of product type. The second endpoint only return the list of type but I need to add ...
Seb's user avatar
  • 3,231
0 votes
1 answer
78 views

Android flingBehavior button to scroll back to start

I have a LazyRow containing multiple Card items that the user can scroll through. I wanted this to be snapping to each of these items, so I added flingBehavior to the LazyRow. My question now is: How ...
dennisklad's user avatar
0 votes
1 answer
70 views

What is the best way to use a recursive function in a Kotlin Coroutine so that it can be cancelled and restarted?

I am trying to run a recursive function on a background thread and be able to cancel it and restart it when the user clicks a button. I have read through some coroutine basics but still not getting ...
Matt5920's user avatar
0 votes
2 answers
68 views

How to propagate the changes from Room when I perform an update?

I have 7 items in Room and I want to update the name of one item. Here is what I have tried: interface ItemDao { @Query("SELECT * FROM item_table") fun getItems(): Flow<List<...
Always Learner's user avatar
-2 votes
1 answer
53 views

Jetpack Compose Framework - Android - Kotlin - In a Textfield, why isn't 'query' value being changed once my suspend coroutine is completed?

Short: In my Textfield, why isn't "query" value being cleared once my coroutine is completed? In my Textfield composable, I am testing a "query" value being passed through a ...
P Attah's user avatar
0 votes
0 answers
72 views

Android Glance Widget Error: Truncated Column container from 11 to 10 elements - IllegalArgumentException

I get the following Error when building my GlanceWidget. Full StackTrace: Truncated Column container from 11 to 10 elements java.lang.IllegalArgumentException: Column container cannot have more ...
Samuel's user avatar
  • 439
2 votes
4 answers
126 views

Android Compose state not available inside kotlin Coroutines

I have something like this : class MyViewmodel(repository: Repository, sv: SaveStateHandle): Viewmodel() { var user by mutableStateOf(User(id = "", name = "") ...
Ping Chung Long's user avatar
1 vote
2 answers
74 views

How to get the new item name when I perform an update in Room?

I have 5 items in Room and I want to update the name of one item. Here is what I have tried: interface ItemDao { @Query("SELECT * FROM item_table") fun getItems(): Flow<List<...
Always Learner's user avatar
1 vote
0 answers
58 views

Compose UI not waiting for viewModel's coroutine results. GoogleMap composable

I have a compose screen that shows Google Maps. I'm using this state model: data class CragsOnMapsState( val currentLocation: Location? = null, val cragsList: List<Crag>, val ...
juske's user avatar
  • 312
4 votes
2 answers
194 views

How to use Dispatchers.IO correctly to read local files on Android?

In the Android documentation it says the following: Dispatchers.IO - This dispatcher is optimized to perform disk or network I/O outside of the main thread. Examples include using the Room component, ...
A. Cedano's user avatar
  • 1,001
3 votes
1 answer
100 views

Coroutines don't advance when testing Ktor with Jetpack Compose

I'm trying to test my code that uses Ktor: WeatherRepository: class WeatherRepository( engine: HttpClientEngine, private val locationClient: LocationClient ) { ... suspend fun getCurrentWeather(): ...
Yauheni Mokich's user avatar
0 votes
0 answers
53 views

MutableStateFlow not being updated on @Composable

Currently I have a WebAppInterface that detects the events of the web, such WebAppInterface is called inside a @Composable WebView, inside the WebAppInterface I have a function that I have ...
Tony's user avatar
  • 387

15 30 50 per page
1
2 3 4 5
15