Sending an Intent to browser to open specific URL

This question already has an answer here:

  • How can I open a URL in Android's web browser from my application? 28 answers

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

    Here's the documentation of Intent.ACTION_VIEW .


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


    The short version

    Intent i = new Intent(Intent.ACTION_VIEW, 
           Uri.parse("http://almondmendoza.com/android-applications/"));
    startActivity(i);
    

    should work as well...


    最短的版本。

    startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")));
    
    链接地址: http://www.djcxy.com/p/41958.html

    上一篇: Android:我可以使用第三方应用程序的这个意图吗?

    下一篇: 发送一个意图到浏览器打开特定的URL