2013年1月1日 星期二

How to open an URL in Android’s web browser

Here’s a code snippet to show you how to use “android.content.Intent” to open an specify URL in Android’s web browser.
button.setOnClickListener(new OnClickListener() {

 @Override
 public void onClick(View arg0) {

  Intent intent = new Intent(Intent.ACTION_VIEW, 
    Uri.parse("http://2mecode.wordpress.com"));
  startActivity(intent);

 }

});

沒有留言:

張貼留言