Cdacians

Cdacians
Cdacians

Thursday, 23 August 2012

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://www.mkyong.com"));
   startActivity(intent);
 
  }
 
 });
Note
For full example, please refer to this – Android button example.

References

  1. Android Button JavaDoc
  2. Android Intent.ACTION_VIEW JavaDoc
Thanks
akm
www.cdacians.com

No comments:

Post a Comment