The call to finish () does not exit

I want to end my activity when it is suspended for certain reasons. Until recently, my code worked fine, but recently the finish() method has 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"} 

Can anyone help me with this?

OnPause() method

 @Override protected void onPause() { super.onPause(); finish(); } 
+7
source share
2 answers

You can check if your activity is completed by calling if (isFinishing()){} and calling finish only if it is not. Alternatively, you can specify android:noHistory="true" in your activity in the manifest file, which will actually end your activity after the user leaves it.

+12
source

You most likely have duplicate copies of the action being performed. I suggest doing all the actions under one parent and using

 finishall() 
-7
source

All Articles