Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
345 views
in Technique[技术] by (71.8m points)

android - 发送意图到浏览器以打开特定的URL [重复](Sending an Intent to browser to open specific URL [duplicate])

This question already has an answer here:

(这个问题已经在这里有了答案:)

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

(我只是想知道如何在手机浏览器中启动一个Intent以打开特定的URL并显示它。)

Can someone please give me a hint?

(有人可以给我提示吗?)

  ask by poeschlorn translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

To open a URL/website you do the following:

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

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

Here's the documentation of Intent.ACTION_VIEW .

(这Intent.ACTION_VIEW文档 。)


Source: Opening a URL in Android's web browser from within application

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...