-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!

Sach
  • 3,115
  • 3
  • 17
  • 35
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,622
  • 4
  • 39
  • 62
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,338
  • 20
  • 30
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,157
  • 1
  • 26
  • 45
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,454
  • 3
  • 34
  • 49