Saturday, March 29, 2014

Open URL - Android

The following three lines of code will open a URL in an Android app. I'm guessing you cannot open a local html file using the same method in your browser.

Intent intent = new Intent(Intent.ACTION_VIEW,Uri.parse("http://www.google.com"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
startActivity(intent);

No comments: