+ 1

How can we load url whenever any options is pressed from navigation drawer in android app using Android studio?

24th Jun 2020, 10:35 AM
Dixit Joshi
Dixit Joshi - avatar
4 odpowiedzi
+ 2
Override the onNavigationItemSlected method. than within that method create a switch case. switch (item.getItemId()){ default: //Than you can load your desired URL break; }
25th Jun 2020, 3:00 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
+ 2
So if you have successfully created a NavigationView in your app. Than you can just fetch the I'd of your NavigationView and set those Navigation items on the listener. NavigationView navigationView=findViewById(R.id.Your_navigationView); navigationView.setOnNavigationItemSelected(new NavigationView.OnNavigationItemSelected(){ @Override public void OnNavigationItemSelected(MenuItem Item){ //For all Items switch (item.getItemId()){ default: break; } });
26th Jun 2020, 3:41 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
0
I am using fragments so will this work in fragments?
26th Jun 2020, 2:22 AM
Dixit Joshi
Dixit Joshi - avatar
0
And can you please elaborate this code?😃 Means by giving an example.
26th Jun 2020, 2:23 AM
Dixit Joshi
Dixit Joshi - avatar