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

Developing app using Room and Compose. I want to achieve the following: User opens Screen A with list of parent categories. User opens Screen B by clicking category: during the navigation, app passes ...
DJ-Glock's user avatar
  • 1,453
2 votes
1 answer
95 views

My UI is not updating to show the new list of items when I change customers. I have a Composable screen to display the customer and a list of the items for that customer. When I select a new customer, ...
jonathan3087's user avatar
4 votes
1 answer
124 views

I’m using Jetpack Compose with StateFlow in a ViewModel. I have a Map<String, List<Int>> and I want to sort it by the size of each list, then display the sorted result in the UI. Inside my ...
Ahmad Njres's user avatar
0 votes
1 answer
72 views

Let's say I have some kind of structure like this: data class C(val value: Int) { @Composable fun MyComposable() { Text("Value: $value") } } @Composable fun ...
kkandroid's user avatar
1 vote
1 answer
111 views

I'm working on a Jetpack Compose app where I fetch book data from a server using a BooksViewModel. The UI should update based on the state (Loading, Success, or Error). However, the UI only shows the ...
Vivek Modi's user avatar
  • 7,859
5 votes
1 answer
235 views

I have a ViewModel that exposes a StateFlow representing the UI state of a book list: class BooksViewModel(private val getBooksUseCase: GetBooksUseCase) : ViewModel() { val booksState: Flow<...
Vivek Modi's user avatar
  • 7,859
2 votes
2 answers
228 views

I have created a compose project that follows the standard architecture sttucture of a project. It has a data class, interface, api class, repository. The repository is connected to a viewmodel and ...
CodeNerd's user avatar
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
116 views

I am using Jetpack Compose with a NavHost and NavHostController to handle navigation. I have a dialog that appears when a button is clicked. This dialog includes a button that navigates to another ...
Andrej Plavsic'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
1 vote
1 answer
139 views

I am trying to better understand how StateFlow can be used by writing simple code in a scratch file in Android Studio. I just want to update a StateFlow and collect the result. The code is the ...
eqtèöck's user avatar
  • 1,115
0 votes
1 answer
634 views

In my KMM app, I have my kotlin shared code with this method: fun getUserProfile(): Flow<UserInfo?> = firestore.collection("UserInfo").document(auth.currentUser!!.uid)....
Cipri's user avatar
  • 253
1 vote
1 answer
42 views

I have this code for image analysis, and I'm trying to pass the processed text data list to the view model. The text is recognized, but it doesn't get properly sent to the view model. I logged the ...
Gábor Madový's user avatar
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
2 answers
83 views

I'm writing a simple todo app using compose and stateflow. data class Task( val name: String, val isCompleted: Boolean, val date: Long ) class SomeViewModel : ViewModel() { private ...
HukeLau_DABA's user avatar
  • 2,536
1 vote
1 answer
80 views

In a sample project I have a viewModel with two use cases. Both use cases call the same repository. One fetches via a flow a list of tasks that stores the repository in a StateFlow. The other provides ...
Diego's user avatar
  • 11
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
3 votes
2 answers
122 views

I have the below list of items which has a checkbox next to each item in the form of a button. When the button is not selected, a black empty circle should show. When the button is selected there ...
GVG's user avatar
  • 647
4 votes
2 answers
134 views

I have a ViewModel with a stateFlow. Everytime that a button is clicked, I'm changing the value to the state but, for some reason, the screen is not reacting to that change. I know that the state's ...
juske's user avatar
  • 310
1 vote
1 answer
165 views

I'm currently developing an Android app that displays multiple sections of movie lists. Each section's UI state is managed independently using separate StateFlows in the ViewModel. Here's a simplified ...
송규빈's user avatar
0 votes
1 answer
209 views

I have a Repository + UseСase + ViewModel + MVI architecture. I have a UseCase for collecting Flow, and another UseCase to update Flow in repository When I go to the screen, collect fires and gives me ...
onesector's user avatar
  • 471
1 vote
1 answer
51 views

I know this have been asked many times, but none of the solutions helped me. I have a StateFlow<String?> that is supposed to guard a token when it arrives from an API call. it is implemented in ...
KaduCmK's user avatar
  • 23
2 votes
2 answers
189 views

In my application, when updating the map StateFlow is not updated. Help me update StateFlow correctly. data class PageData(val selectedCheckbox: Int, val enable: Boolean) @HiltViewModel internal ...
Ruslan's user avatar
  • 55
2 votes
2 answers
449 views

I need that when the var called CustomSingleton.customVar stored in a singleton is modified, my composable gets recomposed to change the current screen in the navhost. So I did this on the viewmodel ...
NullPointerException's user avatar
1 vote
1 answer
91 views

When the first page results (20) are scrolled down and when there are new results from the next page the screen flickers/refreshes. Tried many things but no idea how to stop this screen flickering. ...
AndroidDev's user avatar
  • 5,635
1 vote
1 answer
155 views

I am trying to upgrade my java code to kotlin but I don't know how to aproach this transition. It seems that I have to perfectly understand corutines which is a pain because it seems too much all at ...
Chris's user avatar
  • 125
1 vote
1 answer
105 views

In my application I get the list of films by api and can add them to the list of favourites which is stored in the database room. So on the screen with the list of favourite films when I try to delete ...
alexxelo's user avatar
2 votes
1 answer
92 views

I made some changes to Skizo-ozᴉʞS ツ variant and now it works fine: private val eventsChannel = MutableSharedFlow<Event>( replay = 1, extraBufferCapacity = 64, onBufferOverflow = ...
alex's user avatar
  • 23
1 vote
1 answer
264 views

I investigated for hours and searched the web (and even bothered ChatGPT) and I'm puzzled this hasn't been solved yet to my (obviously very limited) knowledge. So this is the setup: I have a view ...
nepa's user avatar
  • 1,472
1 vote
1 answer
484 views

Firstly, I'm not a developer or anything, but I wanted an app that doesn't exist for my phone and I understand a minimal amount of coding, went through the Android Kotlin/Jetpack Compose basics course,...
sardonicus87's user avatar
1 vote
1 answer
43 views

I Have the following sealed class sealed class SearchedState { data class FoundCrag(val crag: Crag): SearchedState() data class FoundZone(val zone: Zone) : SearchedState() data class ...
juske's user avatar
  • 310
1 vote
2 answers
378 views

When working with MutableStateFlow in my viewmodel, I got the following compile error: "Type mismatch. Required: Bar, Found: Unit" Here is my stripped-down code: import androidx.lifecycle....
SMBiggs's user avatar
  • 11.8k
0 votes
0 answers
89 views

I am building an app and I am using Flow and State. I have 2 fragments A and B. They are never displayed at the same time. In each fragment I am observing the change of state as below: private fun ...
Seb's user avatar
  • 3,255
1 vote
1 answer
1k views

I'm relatively new to Android development. While designing the application, I encountered some problems. Everything I found did not quite cover my needs. I would like to listen to your pieces of ...
Mikhail Dubovikov's user avatar
1 vote
1 answer
1k views

I'm using a MutableMap to save the data which is updates every 5 seconds and I expect also to be updated the UI showing part of the Map. After trying different solution I found that if I add another ...
Georgy G's user avatar
0 votes
0 answers
395 views

I'm currently working on a Jetpack Compose screen in my Android app, and I've noticed that every time I click on a button, the entire screen seems to recompose. This behavior is causing some ...
Navid Jl's user avatar
2 votes
1 answer
368 views

I'm trying to achieve the following behavior on my TODO app: when user touches a circle in the top bar a date is selected and the tasks list must change to show tasks of that date when user touches a ...
pochopsp's user avatar
  • 1,150
4 votes
1 answer
593 views

I have LoginViewModel which contains Compose state backed field for email and password. I want to create a StateFlow for enabling/disabling the Login button. I use combine and snapshotFlow, and ...
wiryadev's user avatar
  • 1,530
1 vote
1 answer
215 views

Created below MutableStateFlow for understanding how collecting works using StateFlow. Is the below code valid? How we can right correctly? val _mutableStateFlow = MutableStateFlow(0) val stateFlow: ...
r_dev's user avatar
  • 31
1 vote
1 answer
1k views

just started picking up Compose MP and have been running into difficulty combining 2 sources of mutablestates to a new mutablestate or flow within a viewmodel. per documentation, I figured ...
Shay_A's user avatar
  • 57
2 votes
2 answers
895 views

I have a viewmodel class that uses a StateFlow that is created using the StateIn operator. I.E. private val _state = MutableStateFlow(MyState()) private val myItems = myRepository.myFlow.stateIn( ...
tomerpacific's user avatar
  • 6,851
1 vote
1 answer
53 views

I have two StateFlows of lists in ViewModel (local and remote), which are combined into single uiState, which is used in Compose user interface. User is picking values from remote source which are ...
OndraVojta's user avatar
1 vote
3 answers
289 views

I have a fragment that shows a location after collecting it from the viewmodel stateflow, the location is stored in shared preferences than emitted to a mutableflowstate when the fragment starts. The ...
Jamal N's user avatar
  • 698
0 votes
1 answer
32 views

I have this fragment that has a recycler view with it's adapter, and I have this methods private fun observeItemsStateAndSetButtonStyle(type: String) { when(type) { TaxonomyType.PROVINCE....
Albert Buigues's user avatar
4 votes
3 answers
5k views

I'm encountering a situation where a MutableStateFlow in my Kotlin code isn't emitting the same value twice in a row, even when I explicitly call emit() with the same value. This is preventing my ...
MohammadBaqer's user avatar
1 vote
0 answers
80 views

I have a very simple list on the screen. Data goes from viewmodel state from database as observable flow (very ordinary case) List item is very simple: it has id, name, order_ (the order of item in ...
Foenix's user avatar
  • 558
1 vote
0 answers
152 views

I am currently migrating an android application from XML, Databinding and Flow/LiveData to Compose, Flow/StateFlow. In this application, I have a very simple Room database: @Entity data class User(@...
rolandl's user avatar
  • 1,907
0 votes
1 answer
173 views

How can I manage webview state flow in ViewModel class. Something like: private val _webView = MutableStateFlow(WebView()) val webView: StateFlow<WebView> get() = _webView fun getWebViewHtml(){ ...
Slava's user avatar
  • 767
1 vote
0 answers
49 views

Test Result is always received first value(=init) and last value(=success) How to get LoaderType State (Fail Case) Without the delay() function, the test case consistently fails, and only the initial ...
Jayden's user avatar
  • 11
0 votes
1 answer
286 views

I have a data class: data class Student( val name: String, var isSelected: Boolean = false ) And in the ViewModel: class FirstViewModel : ViewModel() { private val _student = ...
Sam Chen's user avatar
  • 9,108

1
2 3 4 5 6