I want to finish my activity when it pauses for specific reasons. Up till recently my code was working perfectly but recently the finish()
method stopped doing its job for some reason. Also, when the finish()
method is called, I get the following LogCat
message:
12-31 18:01:23.445: W/ActivityManager(481): Duplicate finish request for ActivityRecord{42465370 u11 "myapplicationpackage"}
Could someone help me out with this?
OnPause()
method
@Override
protected void onPause() {
super.onPause();
finish();
}
You can check if your activity is finishing already by calling if (isFinishing()){}
, and calling finish
only if it is not. Alternatively you might want to specify android:noHistory="true"
on your activity in manifest file, which will actually finish your activity once user navigates away from it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With