java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
I check the connected Internet and if it false, then call method openAsRoot in onCreate() Activity
private void openAsRoot(Fragment fragment) {
manager = getSupportFragmentManager();
manager.beginTransaction()
.replace(R.id.container_main, fragment).commit();
}
it is perfect, but when I open the settings to turn on the Internet and then go back to my application - showed error in
@Override
protected void onRestart() {
if (isConnected()) {
openAsRoot(myFragment);
}
super.onRestart();
}
Error "java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState"
How can I fix this ?