3

I have an Android AppCompatActivity that fails to fire onPause event when the Home button is pressed. According to the Android documentation:

The system calls this method as the first indication that the user is leaving your activity (though it does not always mean the activity is being destroyed);

However, whenever I am in the AppCompatActivity, onPause does not fire when Home button is pressed. Otherwise it fires as expected for back button or normal close of the AppCompatActivity.

I have rebooted the test device with status quo.

I am handling the event as such:

@Override
protected void onPause() {
   super.onPause();
   Log.d(TAG, "onPause - Test");
}

The following event fires with the Home button:

@Override
protected void onUserLeaveHint()
{
    Log.d(TAG,"onUserLeaveHint - Test");

}

However, I cannot do anything but log to console, all other actions are ignored.

Edit

I think this is related. When I do press the Home button, the following exception is thrown:

WindowState: WIN DEATH: Window{7d162a0 u0 com.test.myapp/com.test.myapp.TestActivity}

Which is what happens when an ANR forced kill is executed

Roy Hinkley
  • 10,111
  • 21
  • 80
  • 120

0 Answers0