Thursday, October 29, 2015

Java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

Java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

when i try to remove fragment onStop after onSaveInstanceState got exception .

Original Code 

ft = fm.beginTransaction();
ft.remove(fragment3);
ft.addToBackStack(null);

ft.commit();


Solutions

Instead of ft.commit change to ft.commitAllowingStateLoss();

ft = fm.beginTransaction();
ft.remove(fragment3);
ft.addToBackStack(null);
ft.commitAllowingStateLoss();



Check out this may be help you

Related Posts Plugin for WordPress, Blogger...