向浏览器发送 Intent 以打开特定 URL [英] Sending an Intent to browser to open specific URL

查看:28
本文介绍了向浏览器发送 Intent 以打开特定 URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道如何向手机的浏览器启动 Intent 以打开特定的 URL 并显示它.

I'm just wondering how to fire up an Intent to the phone's browser to open an specific URL and display it.

有人可以给我一个提示吗?

Can someone please give me a hint?

推荐答案

要打开 URL/网站,请执行以下操作:

To open a URL/website you do the following:

String url = "http://www.example.com";
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(url));
startActivity(i);

这是Intent.ACTION_VIEW 的文档.

Here's the documentation of Intent.ACTION_VIEW.

来源:从应用程序内在 Android 的网络浏览器中打开 URL

这篇关于向浏览器发送 Intent 以打开特定 URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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