问题
How can I code my Android application to start the web browser to display a given URL?
(I'd rather not embed a web browser component into my app, but rather want to start the Android web browser to show the URL.)
Thanks!
回答1:
Just use an Intent with the correct action and data:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("http://www.stackoverflow.com"));
startActivity(intent);
回答2:
In case if you have the website displayed on your view and you want it to make it clikable and direct user to particular website You can use:
android:autoLink="web"
In same way you can use different attributes of autoLink(email, phone, map, all) to accomplish your task...
来源:https://stackoverflow.com/questions/2060949/how-do-i-launch-a-url-from-my-application-on-android