I use the traditional android studio navigation drawer to create a navigation drawer ,Can anyone pls help me | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grátis
+ 1

I use the traditional android studio navigation drawer to create a navigation drawer ,Can anyone pls help me

With how I can add a logout item to it import ..... public class HomeActivity extends AppCompatActivity { private AppBarConfiguration mAppBarConfiguration; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_home); Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); DrawerLayout drawer = findViewById(R.id.drawer_layout); NavigationView navigationView = findViewById(R.id.nav_view); // Passing each menu ID as a set of Ids because each // menu should be considered as top level destinations. mAppBarConfiguration = new AppBarConfiguration.Builder( R.id.nav_home, R.id.nav_gallery, R.id.nav_slideshow,R.id.nav_logout) .setDrawerLayout(drawer) .build(); NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); Navigation

19th Oct 2020, 12:02 AM
George S Mulbah II
George S Mulbah II - avatar
3 Respostas
0
Hey I solve the problem the new androidx structure uses the OnchangeDestination(); so if you get stuck like me don't hit your head just contact me I send you the code
26th Oct 2020, 1:53 PM
George S Mulbah II
George S Mulbah II - avatar
+ 1
George S Mulbah what's the point to downvote my answer? I don't know what are u talking about, your problem don't seem to hard hit my head. And it don't need that stuffs, it's simple as it, use your skills.
26th Oct 2020, 2:08 PM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar
0
What do you mean by adding a item to navigation view, it can done easy though. So what's the big problem here?
19th Oct 2020, 3:14 AM
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~
0_O-[Mägár_Sám_Äkà_Nüllpøïntêr_Èxëcéptïön]~~ - avatar