iamsaanvi
By:
iamsaanvi

How can I open a URL in Android's web browser from my application?

September 18, 2017 147 views
Applications

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.ACTIONVIEW, Uri.parse(downloadlink));
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

thank you

Be the first one to answer this question.