Closed ketanbhardwaj closed 3 years ago
I overcome this issue by adding my own method for set and getCurrentItem.
@ketanbhardwaj You can set an index value to itemActiveIndex
.
int currentItem; ` binding.bottomBar.setOnItemSelectedListener(i -> { currentItem = i; if (i == 0) { navController.navigate(R.id.fragment_all_user); } else if (i == 1) { navController.navigate(R.id.topic_fragment); } else if (i == 2) { navController.navigate(R.id.notification); } else if (i == 3) { navController.navigate(R.id.profile_fragment); }
return true;
});`
` @Override public void onBackPressed() { FragmentManager fm = getSupportFragmentManager(); fm.popBackStack(); if (currentItem == 0) { super.onBackPressed(); finish(); } else { currentItem--; binding.bottomBar.setItemActiveIndex(currentItem); }
}`
setCurrentItem method is missing from the SmoothBottomBar class. This is required if I want to manually switch the tab programmatically. Similarly getCurrentItem method is missing as well.
Please provide some workaround for this.
Thanks