How to make, that when clicking the button dialogue with a choice of the browser opened and followed the specified link.

    2 answers 2

    When you click on the button, execute this code

    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(browserIntent); 

    And the best way to learn how to google such things is not a difficult task. For example, here is a link where the first few links will immediately answer your question.

      If you call so:

       Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(browserIntent); 

      then, if the default application for links of this type is installed, the dialog with the choice of what to open does not appear.


      This same method will forcefully show the dialogue even if there is no choice as such:

       Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")); startActivity(Intent.createChooser(browserIntent, "OPEN WITH:"));