I’m making a simple app where I have an activity where the user can edit a document. I do not want to include a specific save button.
Where should I save the document? I looked at the documentation but having never developed for android I found it a bit confusing: should I be using onUserLeaveHint? Or something else?
Basically, I’m looking for a function to override that would get called every time it’s appropriate to save the document, i.e. when the user finishes editing it and thus the activity is closed.
I would probably override your Activity’s
onPause()method and save there. That way any time the user leaves the Activity for any reason whatsoever, it will be saved.