try{
Intent i = new Intent();
ComponentName comp = new ComponentName(
"com.google.android.browser",
"com.google.android.browser.BrowserActivity");
i.setComponent(comp);
i.setAction("android.intent.action.VIEW");
i.addCategory("android.intent.category.BROWSABLE");
Uri.Builder z = new Uri.Builder();
i.setData(z.build());
getContext().startActivity(i);
} catch (URISyntaxException e) {
e.printStackTrace();
}
At this point I lost all faith in humanity and all that's sacred.
Come on people, there must be a better way!
And here I come to save the day :) The code is actually very short and simple:
getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
No comments:
Post a Comment