我该如何推出一个网址从我的Andr​​oid应用程序? [英] How do I launch a URL from my application on Android?

查看:120
本文介绍了我该如何推出一个网址从我的Andr​​oid应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我怎样才能code我的Andr​​oid应用程序启动Web浏览器来显示指定的URL?

How can I code my Android application to start the web browser to display a given URL?

(我宁愿不嵌入一个Web浏览器组件到我的应用程序,而是要开始在Android网页浏览器中显示的网址。)

(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.)

谢谢!

推荐答案

只需使用一个Intent用正确的操作和数据:

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);

这篇关于我该如何推出一个网址从我的Andr​​oid应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆