To open a web page in an Android app, we need to create a new Intent and start a new Activity with it. Here’s a Java method that we can re-use:
1 2 3 4 5 |
private void goToUrl (String url) { Uri uriUrl = Uri.parse(url); Intent launchBrowser = new Intent(Intent.ACTION_VIEW, uriUrl); startActivity(launchBrowser); } |
Just pass the URL of the web page you’d like to open to this method. Source: How to open a website when a […]