On Rotation I Get "Unable To Destroy Activity ... Can Not Perform This Action After OnSaveInstanceState"
Solution 1:
Thanks for your info. Meanwhile, I fixed this issue.
What was causing the problem was a Service that needed to be unbound when the Activty was destroyed because of rotation.
As far as I could understand the Fragments are not destroyed when the activity is destroyed. However, I would appreciate any comment on this.
So, I reinitialized the Fragments on the onCreate()
method when the Activty is created again after destruction, and this is not causing trouble to the application.
protected void onDestroy() {
mService.stop();
stopService(new Intent(this, LocalService.class));
unbindService(mConnection);
g.fermaGrab();
stopService(intent);
Log.e("ondestroy","passostopService(intent)");
super.onDestroy();
}
Solution 2:
Just because the other answers to this question led me on a wild goose hunt of WeakReferences, memory leaks, and onResumeFragments... you can get this error simply by having an onFocusChangeListener
that tries to pop up a dialog box when a control loses focus. The error comes in ActivityThread.handleRelaunchActivity
so it's a little tough to figure out.
Post a Comment for "On Rotation I Get "Unable To Destroy Activity ... Can Not Perform This Action After OnSaveInstanceState""