androidandroid-activityandroid-savedstate

Android Activity Cycle? Text Remains When Activity is destroyed like Whatsapp?


I am new to Android and recently focusing on the Activity cycle. My understanding is that if we destroy an activity class, all the unsaved data will be cleared.

But whatsapp's chat page seems to be quite interesting as after I quit the chat page and re-enter that particular chat page, I would see the unsaved text remain in the edittext box.

So, how would they do the tricks? Is it related to "savedInstanceState" ?

enter image description here


Solution

  • With reference to the comments from Scion of Ikshvaku I created a sqlite table to store the unsent msg in edittext. It would achieve the same result as whatsapp. The trick indeed is not difficult