mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 14:47:29 +00:00
Add activity finishing check before calling onBackPressed. May fix IllegalStateException: Can not perform this action after onSaveInstanceState
This commit is contained in:
parent
28dab3cf0f
commit
4ffab14ff3
@ -208,10 +208,14 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
|
||||
public void onBackPressed() {
|
||||
if (isTaskRoot() && isBackStackEmpty) {
|
||||
finishAfterTransition();
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
if (!isFinishing()) {
|
||||
try {
|
||||
super.onBackPressed();
|
||||
} catch (Exception ignored) {}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onBackPressed: ", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -553,11 +557,10 @@ public class MainActivity extends BaseLanguageActivity implements FragmentManage
|
||||
.build();
|
||||
fragment.setOnShowListener(dialog -> alertDialog.dismiss());
|
||||
fragment.show(getSupportFragmentManager(), "post_view");
|
||||
return;
|
||||
}
|
||||
else {
|
||||
Toast.makeText(getApplicationContext(), R.string.post_not_found, Toast.LENGTH_SHORT).show();
|
||||
alertDialog.dismiss();
|
||||
}
|
||||
Toast.makeText(getApplicationContext(), R.string.post_not_found, Toast.LENGTH_SHORT).show();
|
||||
alertDialog.dismiss();
|
||||
}).execute();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user