Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
272 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 Answer

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)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...