I got confused about using the life cycle of the life cycle in the example with notepad, in the example with notepad use the user model βedit in placeβ, inserting a new record into the onCreate method, keeping a constant state in the onPause method and keeping the source text in the onSaveInstanceState method. I am a J2EE programmer, I can not understand the logic described above. why not make things simple as shown below:
1. Do not add a new record to the onCreate method. 2. When the user clicks the BACK button, it is equal to clicking the save button in the editor, so insert or update in onPause if activity.isFinishing () is true. do not try to use data if activity.isFinishing () is not true. 3. Do not save the source text in the onSaveInstanceState method, it is not needed. If the activity is killed and vice versa, the restoration of the user entering the data in the editor will be adequate.
I think this logic is more traditional and natural. Maybe I do not understand the essence of the life cycle of an activity. Please provide your opinion.
thanks
Ljw
source share