0
我正在使用底部導航視圖,並在其中一個選項中顯示Firebase數據和CardView。當活動返回時不更新Firebase數據 - 底部導航視圖
但是,當我退出此活動並返回時,無論是使用設備後退按鈕還是使用活動箭頭,它都不起作用。不顯示任何東西。
什麼可能是錯的?
代碼底部導航視圖:
BottomNavigationView bottomNavigationView =(BottomNavigationView) findViewById(R.id.bottomNavView_Bar);
BottomNavigationViewHelper.disableShiftMode(bottomNavigationView);
Menu menu = bottomNavigationView.getMenu();
MenuItem menuItem = menu.getItem(0);
menuItem.setChecked(true);
bottomNavigationView.setOnNavigationItemSelectedListener(new BottomNavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){
case R.id.ic_home:
break;
case R.id.ic_explore:
Intent intentExplore = new Intent(HomeActivity.this, ExploreActivity.class);
intentExplore.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intentExplore);
break;
case R.id.ic_calendar:
Intent intentAgenda = new Intent(HomeActivity.this, AgendamentoActivity.class);
intentAgenda.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intentAgenda);
break;
case R.id.ic_person:
Intent intentuser = new Intent(HomeActivity.this, OpcoesUsuarioActivity.class);
intentuser.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intentuser);
break;
}
return false;
}
});
注:在活動測試,而底部的導航或SlidingTabs,它的工作原理一般。