How to open an URL from code in the built-in web browser rather than within my application?
I tried this:
try {
Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(download_link));
startActivity(myIntent);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, "No application can handle this request."
+ " Please install a webbrowser", Toast.LENGTH_LONG).show();
e.printStackTrace();
}
but I got an Exception:
No activity found to handle Intent{action=android.intent.action.VIEW data =www.google.com
Basic Introduction:
https:// is using that one into the "code" so that no one in between can read them. This keeps your information safe from hackers.
http:// is using just sharing purpose, it's not secured.
About Your Problem:
XML designing:
Activity Designing:
Android Manifest.Xml permissions:
You face Problems when implementing this:
Try this:
or if you want then web browser open in your activity then do like this:
and if you want to use zoom control in your browser then you can use:
I think this is the best
Put below code into global class
Try this:
That works fine for me.
As for the missing "http://" I'd just do something like this:
I would also probably pre-populate your EditText that the user is typing a URL in with "http://".
a common way to achieve this is with the next code:
that could be changed to a short code version ...
or :
the shortest! :
happy coding!
A short code version...