I created a basic sample application that all it does is call finish()
during the Activity onStop()
. Based on my understanding and from looking at other posts on Stackoverflow, this should trigger onDestroy()
.
My repro steps are launch the application, press the Home button on the device, which will trigger onStop()
. The expected result is that it also hits onDestroy()
, but I'm not seeing that.
If I call finish()
during onPause()
instead, it will trigger onStop()
and onDestroy()
as expected.
Anyone know why it would work during onPause()
but not onStop()
?
I've also noticed this message in the Logcat
I/ActivityManager: Activity reported stop, but no longer stopping: ActivityRecord{203ab0 u0 com.amazon.myapplication/.MainActivity t96 f}
@Override
protected void onCreate(Bundle savedInstanceState) {
Log.d("Sample", "onCreate");
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
@Override
protected void onStart() {
Log.d("Sample", "onStart");
super.onStart();
}
@Override
protected void onResume() {
Log.d("Sample", "onResume");
super.onResume();
}
@Override
protected void onPause() {
Log.d("Sample", "onPause");
super.onPause();
}
@Override
protected void onStop() {
Log.d("Sample", "onStop");
finish();
super.onStop();
}
@Override
protected void onDestroy() {
Log.d("Sample", "onDestroy");
super.onDestroy();
}