Every posts are for navigation drawer but as I am using Bottom navigation I couldn't find any solutions. searched and tried all threads.
This is my selector method for selecting the menu items
public boolean onNavigationItemSelected(@NonNull MenuItem item)
{
View v=null;
int id = item.getItemId();
switch (id){
case R.id.search:
fragment = new Search();
break;
case R.id.todo:
fragment = new ServiceTable();
break;
case R.id.info:
fragment = new Orderlist();
break;
case R.id.close:
//have to implement double click here.
break;
}
final FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.replace(R.id.main_container, fragment).commit();
return true;
}
});
if (savedInstanceState == null) {
bottomNavigation.setSelectedItemId(R.id.search);
}
}