Closed hidroh closed 6 years ago
I'd recommend onResume/onPause because you want to handle clean up here:
"onPause() is where you deal with the user leaving your activity. Most importantly, any changes made by the user should at this point be committed (usually to the ContentProvider holding the data)." https://developer.android.com/reference/android/app/Activity
Also in cases of low memory the system might kill paused activities so you'd probably want to have cleaned up.
Hi, according to Android documentation,
onStart
/onStop
are the callbacks for when Activity starts to be visible/invisible, andonResume
/onPause
are for when Activity is in foreground or not. This is especially true for Android N in split screen mode, when Activity may be paused but still visible. With that in mind, should we connect/disconnect API client duringonStart
/onStop
instead ofonResume
/onPause
as inBaseDemoActivity
?