In this tutorial we learn how to open url from android web-browser.
The below code snipet is useful for this
String strURL = "http://www.google.com"; Intent myIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(strURL)); startActivity(myIntent);
If some time tour URl not contain "http://" or "https://" that time you need to check this below condition.
if (!url.startsWith("http://") && !url.startsWith("https://")){ url = "http://" + url; }
No comments:
Post a Comment