安卓:发送的意图,浏览器打开特定的URL意图、浏览器、URL

2023-09-12 00:05:12 作者:小姐,你胸到我了

我只是想知道如何在一个Intent火起来到手机上的浏览器打开一个特定的网址,并显示出来。

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 a hint?

时也有一个方法可以直接通过COORDS谷歌地图显示?

Is there also a way to pass coords directly to google maps to display?

推荐答案

要打开一个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.