Sebuahhobi98

main activity

Oct 31st, 2021 (edited)
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.98 KB | None | 0 0
  1. protected void onCreate(Bundle savedInstanceState) {
  2.         super.onCreate(savedInstanceState);
  3.         setContentView(R.layout.activity_main);
  4.         Toolbar toolbar = findViewById(R.id.toolbar);
  5.         setSupportActionBar(toolbar);
  6.  
  7.         DrawerLayout drawer = findViewById(R.id.drawer_layout);
  8.         NavigationView navigationView = findViewById(R.id.nav_view);
  9.         // Passing each menu ID as a set of Ids because each
  10.         // menu should be considered as top level destinations.
  11.         mAppBarConfiguration = new AppBarConfiguration.Builder(
  12.                 R.id.nav_home, R.id.nav_ip_address, R.id.nav_schedule, R.id.nav_setting_audio)
  13.                 .setDrawerLayout(drawer)
  14.                 .build();
  15.         NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment);
  16.         NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration);
  17.         NavigationUI.setupWithNavController(navigationView, navController);
Add Comment
Please, Sign In to add comment