i'm just getting started with Android Studio. I want to know how can i access the broswer, giving it a certain URL (that in the future will be the IP address of an IP camera).
Asked
Active
Viewed 101 times
-3
-
1Use webview for this purpose. – Syed Hamza Hassan Apr 10 '18 at 14:26
2 Answers
0
You can do following:
Intent intent= new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.google.com"));
startActivity(intent);
Sagar
- 20,467
- 4
- 50
- 56
0
Try this:
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);
That works fine for me.
As for the missing "http://" I'd just do something like this:
if (!url.startsWith("http://") && !url.startsWith("https://"))
url = "http://" + url;
Rohit5k2
- 16,859
- 8
- 38
- 56
Gürkan Çintesun
- 49
- 1
- 8
-
Can we maybe *not* copy answers wholesale from duplicate questions? Or at least reference the person who initially has given the answer? – M. Prokhorov Apr 11 '18 at 13:46