Skip to main content
Stack Overflow for Teams is now Stack Internal: See how we’re powering the human intelligence layer of enterprise AI. Read more >
Filter by
Sorted by
Tagged with
0 votes
1 answer
28 views

I have an activityUiState (of type ActivityUiState) object which has a list of sub-activities (of type ActivityUiState as well) and a list of voice notes. I'm trying to populate the activityUiState ...
Joyce Opio's user avatar
0 votes
2 answers
52 views

I am trying to test the number of times a Flow is collected - runTest { var count = 0 backgroundScope.launch(UnconfinedTestDispatcher(testScheduler)) { dao.getEntities().collect { ...
jL4's user avatar
  • 1,242
2 votes
2 answers
97 views

I want to retrieve a specific column from my Android ROOM Database but it kept returning an empty list. Here is the code on my DAO interface: @Query("SELECT * FROM expense_table ORDER BY category ...
JazzAnt's user avatar
  • 23
2 votes
2 answers
112 views

I want to implement a query that returns a result. Android requires that this type of query occurs on a separate thread to avoid locking up the UI thread. My code is based on the tutorial https://iifx....
bittids's user avatar
  • 180
1 vote
1 answer
74 views

I have a data stream coming from the server. The server does not provide any information about when the next piece of data will arrive. I have a Flow in my repository that emits data as it arrives. ...
Vivek Modi's user avatar
  • 7,859
1 vote
3 answers
106 views

I'm making a little app to save my collection of records, I have a search bar, a menuBar with three categories and each record has a button to add to collection and one to add to wishlist, I try to ...
lephoquebleu's user avatar
1 vote
1 answer
66 views

Is there a way to initialize a MutableStateFlow with data obtained from a database? I tried the following approach, but the recordedActivityUiState is not updated with the object from the ...
Joyce Opio's user avatar
0 votes
1 answer
54 views

I have a Bluetooth tracker app. I try it to be clean. Everything related to scan is encapsulated in one class. I am injecting with Hilt. The problem is when I scan via Bluetooth for 10s, I emit the ...
sepideh's user avatar
  • 49
0 votes
1 answer
96 views

I am rather new to Ktor and try to upload a file to my server. This is the route: fun Application.module() { install(ContentNegotiation) { json() } routing { post("/upload") { ...
KCD's user avatar
  • 698
1 vote
1 answer
60 views

I am using the MVVM model and have come across a problem with Stateflow that I cannot find a solution. Perhaps I am approaching the problem in the wrong way. Each of my Models responds to a specific ...
SMBiggs's user avatar
  • 11.8k
0 votes
0 answers
110 views

The endpoint sends Server Sent Events, as strings and it is reactive(Same as Firebase). Each record corresponds to one line(or one string), then I map it to the actual data class. I want it to create ...
Mario Manhique's user avatar
3 votes
2 answers
237 views

The problem is the view model state and the content showing on the screen mismatches. I have a shared ChatViewModel in two screens. It is initialized in the navigation as such: val userId = "...
GenyoNguyen's user avatar
3 votes
1 answer
85 views

I have a very verbose root composable called HelloCompose. This compose is backed by HelloComposeViewModel which contains lots of variables. I am trying to cleanup my HelloCompose code so that it is ...
J. Cool's user avatar
  • 151
0 votes
1 answer
22 views

I have suspending function, which returns a hot flow. suspend fun createFlow(): SharedFlow How can I build another SharedFlow, which calls createFlow lazily (i.e. as only first subscriber connects to ...
Alexey's user avatar
  • 3,202
0 votes
1 answer
253 views

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,859
0 votes
1 answer
55 views

Learning about flows and the interface definition is this: interface Flow<out T>{ suspend fun collect(collector: FlowCollector<T>) } collect has no function parameter yet I'm allowed ...
Ken Kiarie's user avatar
1 vote
0 answers
55 views

I have the following flow operator: fun <T> Flow<T>.bufferedWithTimeout( maxBufferSize: Int, timeout: Duration ): Flow<List<T>> { require(maxBufferSize > 0) { &...
Calamity's user avatar
  • 1,060
3 votes
1 answer
174 views

I am studying native Android development. I found the Architecture Learning Journey of the Now in Android App interesting. I don't understand why in many parts of the code, data is collected and ...
Roberto Aversa's user avatar
1 vote
0 answers
43 views

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
1 vote
1 answer
67 views

Please run this example below. It won't show loading message "Result Loading in viewmodel" as it's supposed to be called during Flow.onStart() where Result.Loading is emitted. How can I get ...
Po-Ting Huang's user avatar
1 vote
2 answers
122 views

I want to concatenate the results of two SQL queries I implemented using the Room library. I will put an example to present it more clearly: In my DAO file: @Query(SELECT plantId FROM PlantView WHERE ...
Akronix's user avatar
  • 2,187
5 votes
1 answer
155 views

I have a repository function that returns me the user profile: private val repoScope = MainScope() fun getProfile(): CommonFlow<User> = firestore.collection("User")....
Cipri's user avatar
  • 253
0 votes
0 answers
52 views

I have this in my DAO @Query("SELECT * FROM reminders") fun getAll(): Flow<List<ReminderEntity>> This in my Repository override fun getAllRemindersAsFlow(): Flow<List<...
OhhhThatVarun's user avatar
0 votes
2 answers
78 views

I have a flow of the events, there are two types of events - initial or non-initial. data class Event( isInitial: boolean, ) val flow: MutableStateFlow<Event?> = MutableStateFlow(null) ...
Vasily Kabunov's user avatar
1 vote
1 answer
232 views

I am working on an app that has a typical list and detail view. When I enter data into the detail form and save, the list doesn't refresh to include the new item. Here's some code to show what I'm ...
Code-Apprentice's user avatar
1 vote
2 answers
111 views

Having this on my viewmodel: val uiState: StateFlow<BusStopsDBScreenUiState> = busDataRepository.getBusStops() .map<List<BusStop>, BusStopsDBScreenUiState> { busStops -> ...
NullPointerException's user avatar
0 votes
0 answers
67 views

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. ...
Dan's user avatar
  • 1
3 votes
1 answer
198 views

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 ...
SMBiggs's user avatar
  • 11.8k
0 votes
0 answers
57 views

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 ...
Cipri's user avatar
  • 253
0 votes
2 answers
90 views

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....
kevin liao's user avatar
1 vote
1 answer
58 views

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 { ...
Always Learner's user avatar
2 votes
1 answer
130 views

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 ...
user28512479's user avatar
2 votes
2 answers
91 views

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())...
MaBed's user avatar
  • 425
1 vote
1 answer
99 views

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 ...
Sirop4ik's user avatar
  • 5,233
0 votes
1 answer
68 views

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 ...
MaBed's user avatar
  • 425
0 votes
0 answers
34 views

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"...
khpylon's user avatar
  • 13
4 votes
1 answer
84 views

If I have multiple parameters that I am getting from the repository which is getting it from a datastore. How should I properly initialize them? This is my current approach: @HiltViewModel class ...
Aditya Anand's user avatar
1 vote
1 answer
214 views

I'm having a curious issue when dealing with flatMapLatest and emptyFlow as well as firstOrNull. Scenario A: val dataFlow: Flow<Boolean> = emptyFlow() launch { val data = dataFlow....
robyn's user avatar
  • 13
0 votes
1 answer
37 views

I admit...the design have issues but looking for a quick solution for now. I have this code try { val query = query goes here val queryFlow = query .queryChangeFlow(...
Nie Selam's user avatar
  • 1,461
-1 votes
1 answer
76 views

I'm new to Jetpack Compose and I'm facing an issue with implementing a button click. My scenario is as follows: I need to call an API when a button is clicked and update the UI once the response is ...
S S's user avatar
  • 301
0 votes
0 answers
78 views

In below code seems that Flow is emitted between deleteAll and insertAll.. I expected to perform these methods together as a transaction. Am I missing something? private const val ...
tomapplause's user avatar
2 votes
0 answers
75 views

I have a database query with two input parameters. Defined in my DAO as: @Transaction @Query("SELECT * FROM event WHERE id = :id AND time > :time") abstract fun getEventsFlow(id: Long, ...
denver's user avatar
  • 3,175
-2 votes
2 answers
1k views

I'm trying to create a Flow that "modifies" the current Flow by waiting at least a certain amount of time before returning the first result. I'd like, of course, to start processing the ...
TesX's user avatar
  • 933
0 votes
0 answers
65 views

I am trying to fetch "name" field from my firestore database, with two different processes. In both process, I am using a helper class to fetch data as Flow<List<String>> and ...
Prakhar_Pathak's user avatar
1 vote
1 answer
328 views

I have a compose component which fills the whole fragment. ViewModel has some items as a state to populate in the screen. Should I pass the viewmodel or only state as a parameter to composable ...
abdullahsen's user avatar
0 votes
1 answer
38 views

I am trying to make a simple app that uses firestore, that just insert the token of devices and fetch the names corresponding to that token. When I tried to fetch "name" value , the flow in ...
Prakhar_Pathak's user avatar
3 votes
1 answer
136 views

In my Android app, I am fetching data from Room and displaying it on maps. I came across these two view model approaches to fetch data. Which one is the more effective and good approach? Currently, I ...
Pawandeep Singh's user avatar
1 vote
1 answer
49 views

Whenever I trigger the "FavoritePost" or "DeletePost" and the uiState has TAB_TWO (Favorites) selected it either swaps to TAB_ONE, stays in TAB_TWO but displays all the Posts ...
Andrei-Alin Dulceanu's user avatar
0 votes
1 answer
55 views

I am trying to collect flow data in activity A emitted from the Activity B but not receiving collect in Activity A, Is flow emit data inside current activity only? Emitting data from fragment view ...
Dalvendra Singh's user avatar
0 votes
1 answer
75 views

I have class MyViewModel(private val activitiesRepo: ActivitiesRepo) : ViewModel() { val activities = mutableStateListOf<Activity>() private var activitiesFlow = activitiesRepo....
wuujcik's user avatar
  • 66

1
2 3 4 5
21