open Browser - Android android.content

Android examples for android.content:Intent

Description

open Browser

Demo Code

import android.content.Context;
import android.content.Intent;
import android.net.Uri;

public class Main {

  public static void openBrowser(Context context, String urlText) {
    Intent intent = new Intent();
    intent.setAction("android.intent.action.VIEW");
    Uri url = Uri.parse(urlText);//from  w  w  w. j a  va  2s .  com
    intent.setData(url);
    context.startActivity(intent);
  }

}

Related Tutorials