Reputation: 727
This is more of a conceptual question.
Android recently introduced the concept of handling the state during process death inside viewModel rather than savedInstanceState
which previously used to be in Activity or Fragment.
My question is how do I test this process death? If I rightly understand the documentation, the Process death happens to be Android killing the app due to full memory when app is no longer used in background.
Also will the viewModel save the state when user kills the app from the RAM? So that I can retrieve the state as the user opens the app again.
Upvotes: 3
Views: 2834
Reputation: 598
Below Steps helps in testing the intelligence of View Model Saved State Library
Step 1: After completing the source code changes, build and run the APP.
Step 2: Ensure UI of Activity/Fragment has data populated in it.
Step 3: Move the App to background by clicking Home Button.
Step 4: Now Open the Logcat Tool window and Terminate the APP.
Step 5: Relaunch the APP from the Device or Emulator.
Step 6: You should see all the data pre-populated in UI.
Upvotes: 0
Reputation: 1566
Activity.onDestroy
called)Upvotes: 3