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 105 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
- 23,903
- 4
- 62
- 62
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
- 17,948
- 8
- 45
- 57

Gürkan Çintesun
- 59
- 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