-4

When user click on alert massage know more button open mobile browser and display URL of my website on android apps what I have made.I need the code. I have tried many code like web view and others, but not working. Please help me!

Sachin
  • 3,424
  • 3
  • 21
  • 42
Franco G
  • 1
  • 2

4 Answers4

1
  Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://stackoverflow.com/"));
  startActivity(browserIntent);

check this for more info

Community
  • 1
  • 1
Shayan Pourvatan
  • 11,898
  • 4
  • 42
  • 63
0

I coded sth for you, dont know if this is the answer you want

          new AlertDialog.Builder(this)
            .setTitle("My homepage")
            .setMessage("Wanna go to my 1337 homepage?")
            .setPositiveButton("OK", new DialogInterface.OnClickListener() {
                public void onClick(DialogInterface dialog, int which) { 
                 Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.my1337site.com"));
                startActivity(browserIntent);
                }
             })             
Oli
  • 3,496
  • 23
  • 32
0
String url = "http://www.xyz.com"; //your URL
Intent openUrl = new Intent(Intent.ACTION_VIEW);
openUrl.setData(Uri.parse(url));
startActivity(openUrl);

add this code on the onclick of the Alert box

AabidMulani
  • 2,325
  • 1
  • 28
  • 47
0

try this

 String url = "http://www.example.com";
    Intent i = new Intent(Intent.ACTION_VIEW);
    i.setData(Uri.parse(url));
    startActivity(i);
Nambi
  • 11,944
  • 3
  • 37
  • 49