+ 1
How to open web page with a click of each navigation item from NavigationItemSelected in android
When selecting the navigation activity in android studio, I saw in the MainActivity.java that there was a conditional if statement for each nav item selected but I want each to open a web page, how do I go bout that
1 Resposta
0
Hi, i suppose those items work like buttons, they trigger an event when pressed, you could use this piece of code inside those events :
String url = "http://www.someurl.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);
what it does, is fire an intent to open the url given, using your default browser