open a url on click of ok button in android

前端 未结 6 383
情深已故
情深已故 2020-12-12 17:15

I have to open a URL on Click of OK Button in a view. Can someone tell how to do this?

6条回答
  •  离开以前
    2020-12-12 17:22

    On Button click event write this:

    Uri uri = Uri.parse("http://www.google.com"); // missing 'http://' will cause crashed
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    startActivity(intent);
    

    that open the your URL.

提交回复
热议问题