EmptyStackException
Fanom2813 opened this issue · 3 comments
Hello guys, i have this problem where by sometimes if i leave the app for a moment and it goes to sleep then i try navigate through the app i get this error :
java.util.EmptyStackException
at com.smartcabspro.user.MainActivity.onBackPressed(:4)
what could be the problem ?
This seems weird. What is your onBackPressed function look like? Do you use navigator.canGoBack function just like in samples? If you do, can you send us a sample that reproduce this crash?
https://github.com/Trendyol/medusa/wiki/Basic-Usage
i have followed the exact same thing as the tutorial
MultipleStackNavigator multipleStackNavigator;
private List<Function0<Fragment>> rootsFragmentProvider = Arrays
.asList(
new Function0<Fragment>() {
@Override
public Fragment invoke() {
return new HomeFragment();
}
},
...
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState)
multipleStackNavigator = new MultipleStackNavigator(
getSupportFragmentManager(),
R.id.fragment_host,
rootsFragmentProvider,
this,
new NavigatorConfiguration(0, true, NavigatorTransaction.ATTACH_DETACH),
null);
multipleStackNavigator.initialize(savedInstanceState);
@Override
public void onBackPressed() {
if (multipleStackNavigator.canGoBack()) {
multipleStackNavigator.goBack();
} else {
super.onBackPressed();
}
}
this error happens to me if i let the phone go to sleep mode when the app is running , then after sometime i start using the app again
It feels like this might related to activity recreation. Did you also override onSaveInstanceState and call navigator.onSaveInstanceState in it?