1,030 questions
1
vote
1
answer
26
views
How to update a value of a UiState on a StateFlow?
Having this on my viewmodel:
val uiState: StateFlow<BusStopsDBScreenUiState> = busDataRepository.getBusStops()
.map<List<BusStop>, BusStopsDBScreenUiState> { busStops ->
...
0
votes
0
answers
24
views
Android serial comms using thread, handler, kotlin flows, suspend functions and compose
I'm trying to write an Android app which requires some serial comms with a bluetooth device. Some of this comms is command/response and some of it is event data that just gets sent from the device. ...
-1
votes
0
answers
20
views
Super methods in service class In Floating Pop up
public void onReceive(final Context context, final Intent intent) {
Log.v(LOG_TAG, "Receieved notification about network status");
WindowManager wm = (WindowManager) context....
3
votes
1
answer
61
views
Android Compose MutableStateFlow: Adding to Set does not invoke recomposition
There are many similar questions about this, but usages have been changing; this is the only question I've found that talks specifically about MutableSets, MutableStateFlows, and collectAsState().
The ...
0
votes
0
answers
40
views
Kotlin Flow does not work as expected if the user does not use the app
I have a food delivery KMM app, and for fetching the restaurants lists, I am not sure if I should use Flow or suspend methods.
I use KMM with Firestore, and my biggest concern is having the data up to ...
0
votes
0
answers
22
views
How to add several Firebase snapshotListeners using flows Kotlin Android [closed]
I want to get two lists from collections both with live updates. They have different references, so I am adding two separate snapshotListeners.
As far as I am concerned, it is is recommended to use ...
0
votes
2
answers
38
views
How to suspend flow emit when collector is suspend?
If I call suspend function, the coroutine should be suspend. But how can I use this to suspend SharedFlow emit?
fun main()= runBlocking<Unit> {
println("before, time is ${System....
1
vote
2
answers
41
views
How to convert the data without collecting the flow?
I'm trying to convert the data I read from a repo class inside a ViewModel like this:
val itemFlow = flow {
repo.getItemList().collect { itemList ->
val itemListResult = try {
...
-1
votes
0
answers
46
views
Updating existing state Flow based on other Flow which starts later in ViewModel
I have a StateFlow which holds the ui states in ViewModel. Based on one specific ui state, one another method call is made and this call returns another Flow. I want to update existing StateFlow (...
2
votes
1
answer
43
views
LaunchedEffect not triggering when adding a new profile in Jetpack Compose
I'm working on a Jetpack Compose app where users can manage login profiles. The profiles are stored in a Room database, and the UI shows the profiles in a dropdown menu. The LaunchedEffect block in my ...
2
votes
2
answers
40
views
Flow producers/builders from multiple coroutines/threads
I have few producers, that emits data each to own flow, I then merge them to single one, which further process the values and consumes them:
fun makeInputFlow() = flow {
while (shouldMakeRequest())...
1
vote
1
answer
48
views
How to change the value of a repository Flow?
I came across this article:
https://proandroiddev.com/loading-initial-data-in-launchedeffect-vs-viewmodel-f1747c20ce62
In this article, the author, while describing the advantages and disadvantages of ...
0
votes
1
answer
42
views
Key-based debounce in Kotlin Flows
I have a flow of key-value pairs (e.g. Flow<Pair<String, Int>>) which I would like to debounce/throttle based on the key, so that when some sequence of pairs with non-unique keys comes I ...
-1
votes
0
answers
31
views
Android Compose: Junk values from UI collected flow
having the same collected flow:
val collectedFlow = viewModel.animationFlow.collectAsStateWithLifecycle(
initialValue = null,
minActiveState = Lifecycle.State.RESUMED
...
0
votes
0
answers
18
views
Runtime java.lang.AbstractMethodError when name of Flow variaable is changes
I have a Room DAO which returns a Flow<List<>>. The DAO looks like this:
interface VehicleInfoDao {
...
@get:Query("SELECT vehicleId, modelId, enabled FROM vehicle_info"...