Here I have written a MutableLiveList<T> class that is intended to replace MutableLiveData<MutableList<T>> in my project. This is working fine till now. But if multiple modifications are done to the list when that activity is in inactive state, then only the last modification to that list will trigger adapter notify methods. In this case I don't know will the app crash. So I needed to mimic that situation exactly. When the screen rotates, activity gets destroyed and recreated. But I don't know how to add items to that list between that interval. Anyone please help me. Or tell me a better way to do it.
Is there any guarenteed way to mimic some action between `onDestroy()` and `onCreate()` methods of an activity being recreated?
101 views Asked by Sourav Kannantha B At
1
There are 1 answers
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in KOTLIN
- getting error when trying to launch kotlin jar file that use supabase "java.lang.NoClassDefFoundError"
- ussd reader in Recket Native module
- making android analyze with coverity sast tool
- Jooq - Insert does not update object with generated id
- Doesn't work TrafficStats.clearThreadStatsTag() in Kotlin
- Difference between map and function returning when in Kotlin
- Every Time i run the app it gives me an error related to gradle
- How Do I Create A Path In The pubspec.yaml File?
- Android jetpack compose webview, image selector not works
- Why doesn't CIOEngine have a dispatcher in kotlin script?
- preventing duplicate text
- onCompletion(mp: MediaPlayer?) is unintentionally called after USB storage is connected
- When using a Room database on an Android application, is it possible to pre-populate data
- Jetpack compose - how I can hookup LiveData property from ViewModel with TextField in activity?
- Failed to getEnergyData
Related Questions in ANDROID-RECYCLERVIEW
- RecyclerView in Fragment Resets when ViewModel Updated without Recreating Recyclerview or calling NotiftDataSetChanged
- In Android Studio, how make an item in the recyclerview open another activity when clicked?
- Error NullPointerExeception: When trying to add Value in ArrayList & adapter.notifydatachanged
- RecyclerView with dynamic content after a complex static layout
- Recycler View is Not Showing Even After Adding Data in Array List & adapter.notifyDataSetChanged()
- Recyclerview columns same width (not fixed) but take as much space as needed
- Can't scroll when using SpannedGridLayoutManager in Recyclerview in Android kotlin
- DemoAPI (JSONs) to recyclerView using retrofit
- How to create design Android using recyclerView with dynamic item
- When I switch an Android Switch on or off, why do Switches in adjacent rows within a Recycler View also switch?
- Android recyclerview - cant able to navigate items using accessibility focus
- Scroll Dynamically added recycler view to position 0
- RecyclerView scrolls to top
- RecyclerView inside bottom sheet is not displayed
- Why isn't My RecyclerView Updating when Data is being saved to My Room Database?
Related Questions in MUTABLELIVEDATA
- TelephonyCallback.CallStateListener with LiveData and ViewModel
- Multiple MutableLiveData change results in a single MutableLiveData
- Activity unable to observe second livedata object within viewmodel
- mutableStateListOf is not updating it value on changing it
- ViewModel function implementation with MutableLiveData or use directly a LiveData?
- MutableLiveData with ArrayList and ArrayAdapter
- How to use MutableLiveData and LiveData in Android?
- Kotlin How to share between 2 different activitiy's 2 different fragments
- Updating MutableLiveData<ArrayList<User>>
- mutableLiveData doesn't trigger recomposition when adding items to a list
- Toast Message keeps appearing when orientation changes
- In Junit test, MutableLiveData value not updating after executing test
- Diff util not updating items in recycler
- How to notify observers after filtering LiveData<List<Note>> using SearchView in ViewModel?
- MVVM Architecture Screen Rotation Issues
Related Questions in MUTABLELIST
- Jetpack Compose not updating without LaunchedEffect of unrelated item
- MutableList becomes empty after navigation to another screen
- java.util.HashMap cannot be cast to "MODEL"
- How is java.util.LinkedList() an instance of MutableList?
- MutableStateOf of mutableList not updating
- Kotlin Array, List, MutableList .plus() not working
- How to add a new item to a MutableLiveData MutableList? (Android - Kotlin)
- MutableList is not updated
- Kotlin. How to fill each line in a list with 5 unique numbers from 1 to 90?
- how to filter on a SQLAlchemy MutableList column
- how to perform dynamic subtraction of a list of numbers with a specific value
- Compare of values from two lists by use of regular expressions in Kotlin
- How to merge two arrays by ID in Kotlin?
- MutableList of MutableLists in Kotlin: adding element error
- How to convert a mutablelist to a collection to use addAll?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
You could add them in the activity's
onDestroycallback function. At that point the activity'sLifecycleobject is either in theCREATEDorDESTROYEDstate:Point is it's not in the
STARTEDstate at that point, and:So by the time you're in
onDestroy, any observer using that activity'sLifecyclewon't see any updates from theLiveData. So you should be able to add values to theLiveDatawithout getting notified.By the way, that "only notified of the last value" update is by design:
So if the data goes
A, B, Cwhile the observer is inactive, it won't be notified of those values. When it goes from inactive to inactive, it'll get the most recent value,C. It doesn't save a history of all the values an observer has missed