You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Could you please provide some implementation in java?
with some initialisation for FragNavController and some onBackPressed method?
In specialy I'm interested in back navigation. I can't implement a back navigation between root fragments. It pops up the fragment from current root, and doesn't move to prevoius root fragment. The app is simply closed.
I am using implementation 'com.ncapdevi:frag-nav:3.2.0' version
@Override
public int getNumberOfRootFragments() {
return 5;
}
fragNavController = new FragNavController(getSupportFragmentManager(), R.id.container);
fragNavController.setRootFragments(fragmentList);
//fragNavController.setRootFragmentListener(this); here it gives a mistake when the app is lauched: IllegalStateException:
//Shouldn't have both a rootFragmentListener and rootFragments set, this is clearly a mistake
//fragNavController.setCreateEager(true); if this line is used the library moves to the 3-rd root fragment
fragNavController.setFragmentHideStrategy(FragNavController.DETACH_ON_NAVIGATE_HIDE_ON_SWITCH);
fragNavController.setNavigationStrategy(new UniqueTabHistoryStrategy((int i, @Nullable FragNavTransactionOptions
fragNavTransactionOptions) -> {
bottomNavigation.setSelectedItemId(i);
}));
fragNavController.initialize(FragNavController.TAB1, savedInstanceState);
if (savedInstanceState == null) bottomNavigation.setSelectedItemId(FragNavController.TAB1);
@Override
public void onBackPressed() {
if (!fragNavController.isRootFragment()) {
fragNavController.popFragment();
} else {
super.onBackPressed();
}
}
Will be very glad for some help!
Best regars, Alex
The text was updated successfully, but these errors were encountered:
Could you please provide some implementation in java?
with some initialisation for FragNavController and some onBackPressed method?
In specialy I'm interested in back navigation. I can't implement a back navigation between root fragments. It pops up the fragment from current root, and doesn't move to prevoius root fragment. The app is simply closed.
I am using implementation 'com.ncapdevi:frag-nav:3.2.0' version
Will be very glad for some help!
Best regars, Alex
The text was updated successfully, but these errors were encountered: