All Questions
Tagged with android-jetpack android-livedata
97
questions
0
votes
1
answer
36
views
How to retrieve db data in View Model using LiveData
After a successful sign-in with Firebase Auth, my Fragment receives the current user details. With these, I would like to look for an existing db record with the same user ID, and if not existing, ...
3
votes
1
answer
1k
views
multiple states for multiple network call in compose viewmodel
I'm fairly new to Jetpack Compose. Currently, I have a ViewModel making 1 network call.
class PlatformViewModel @Inject constructor(
private val getProductListUseCase: GetListUseCase
) : ViewModel() ...
0
votes
1
answer
337
views
Jetpack Compose how to show the latest values in offline mode?
I have weather application. The values comes from rest API. I would like to keep the last data values on the screen in case the user will use the app in offline mode.
I use JetPack DataStore to save ...
0
votes
1
answer
119
views
Android - Store an action in LiveData
I have a dialog system in my app, in which I build some of them at runtime, using a model I pass inside liveData to the UI.
Is it possible to store an action (lambda or something else) inside this ...
1
vote
1
answer
2k
views
MutableLiveData observe method runs but doesn't update Jetpack Compose list
so I wasted a good couple of days on this, and my deadline's tomorrow
basically, I have a mutableLiveData var which is a companion object,
and when the data is updated it calls the observe function ...
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 ...
3
votes
2
answers
9k
views
Android Compose lazycolumn does not update when livedata is changed
I have a list of items where each has a checkbox. The state of the checkbox needs to be stored in the viewmodel and preferable the list in the viewmodel should be the only source of truth.
@Composable
...
0
votes
1
answer
565
views
Android Navigation + LiveData stopped observing when fragment goes to background
I have 2 fragments that i navigate throught navigation component from Jetpack. When i go back from fragment 2 to fragment 1, i fire an event throught livedata from fragment 2 and fragment1 should be ...
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:
...
0
votes
1
answer
2k
views
How can I call jetpack compose function in Observable live data function?
Hi I try to call this a compose function from updatedata(it)
viewModel.ResponseStatus.observe(viewLifecycleOwner) { status ->
when (status) {
FragmentViewModel....
0
votes
1
answer
261
views
MutableLiveData switchMap never called
I'm trying to update my list with MutableLiveData and switchMap() the problem that even if I post new value to the LiveData switchMap() never called.
Here is how i update MutableLiveData from my :
...
8
votes
1
answer
2k
views
Single live events in multiple fragments with Shared ViewModel
I have a shared viewmodel in multiple fragments.
class MainFragment {
private val sharedViewModel: HomeActivityViewModel by activityViewModels()
}
class MagazinesFragment {
private val ...
6
votes
4
answers
12k
views
Jetpack Compose MutableLiveData not updating UI Components
I am trying to display several download progress bars at once via a list of data objects containing the download ID and the progress value. The values of this list of objects is being updated fine (...
0
votes
1
answer
211
views
Android: Transformations.switchMap not triggered when quick call
I'm attempting to learn MVI. I am updating a state event live data that is being observed by a Transformations switch map. This is in my viewmodel.
fun setStateEvent(event: StateEvent) {
Timber.d(&...
0
votes
1
answer
33
views
UI will not be updated after LiveData data is changed
Here is my code:
class HomeFragment : Fragment() {
val viewModel by lazy {
ViewModelProvider(this)[HomeViewModel::class.java]
}
private lateinit var adapter: ArticleListAdapter
...