我的应用程序正在崩溃 Jmeter 板fragemt什么都没有我刚刚创建了一个空白片段公共类mainactivity扩展了appcompatactivity{chipnavigationbar chipnavigationbar;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
chipNavigationBar = findViewById(R.id.bottom_nav_menu);
bottomMenu();
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,new MessageFragment()).commit();
}
private void bottomMenu() {
chipNavigationBar.setOnItemSelectedListener(new ChipNavigationBar.OnItemSelectedListener() {
@Override
public void onItemSelected(int i) {
Fragment fragment = null;
switch (i) {
case R.id.dashboard:
//fragment = new DashboardFragment();
break;
case R.id.message:
fragment = new MessageFragment();
break;
case R.id.profile:
fragment = new ProfileFragment();
break;
}
getSupportFragmentManager().beginTransaction().replace(R.id.fragment_container,fragment).commit();
}
});
}
}
暂无答案!
目前还没有任何答案,快来回答吧!