Android How to - Get Browser Intent








Question

We would like to know how to get Browser Intent.

Answer

//from   w w  w .j  a va 2 s .c om
import android.content.Intent;
import android.net.Uri;

class ActivityUtil {

  public static Intent getBrowserIntent(String url) {
    Intent result = new Intent(Intent.ACTION_VIEW);
    result.setData(Uri.parse(url));
    return result;
  }

}