Example usage for android.content Intent ACTION_VIEW

List of usage examples for android.content Intent ACTION_VIEW

Introduction

In this page you can find the example usage for android.content Intent ACTION_VIEW.

Prototype

String ACTION_VIEW

To view the source code for android.content Intent ACTION_VIEW.

Click Source Link

Document

Activity Action: Display the data to the user.

Usage

From source file:Main.java

public static void openURL(Activity activity, String url) {
    Intent webIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(webIntent);//from  w w w  .j a  v  a2  s  .  c om
}

From source file:Main.java

public static void openBroswer(Context context, String url) {
    Intent it = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    //        it.setClassName("com.android.browser", "com.android.browser.BrowserActivity");  
    context.startActivity(it);/*from w w w  .  j  a  va 2  s. c  o m*/
}

From source file:Main.java

public static void sendSms(Context context, String phoneNum, String content) {
    Intent mIntent = new Intent(Intent.ACTION_VIEW);
    mIntent.putExtra("address", phoneNum);
    mIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    mIntent.putExtra("sms_body", content);
    mIntent.setType("vnd.android-dir/mms-sms");
    context.startActivity(mIntent);// w w w  . j  a  va 2s  .co  m
}

From source file:Main.java

public static void composeSms(Context context, String phoneNumber, String smsBody) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.putExtra("sms_body", smsBody);
    intent.putExtra("address", phoneNumber);
    intent.setType("vnd.android-dir/mms-sms");
    context.startActivity(intent);/*from  w  w  w.ja  v a  2 s  . c om*/
}

From source file:Main.java

public static void startInstall(Context context, Uri uri) {
    Intent install = new Intent(Intent.ACTION_VIEW);
    install.setDataAndType(uri, "application/vnd.android.package-archive");
    install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(install);/*from  w  ww  .java  2  s . co  m*/
}

From source file:Main.java

public static void installApp(Context context, String path) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setDataAndType(Uri.parse("file://" + path), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from  w w w.j  ava2  s .c o m*/
}

From source file:Main.java

public static void accessUrl(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    //intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setData(Uri.parse(url));/*  w ww . jav  a 2s  . c  o  m*/
    context.startActivity(intent);
}

From source file:Main.java

public static void openBrowser(Activity activity, String url) {
    Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
    activity.startActivity(browserIntent);
}

From source file:Main.java

public static void playVideoOrAudio(Context context, Uri uri) {
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from ww w . j  ava2s.  c  o  m
}

From source file:Main.java

private static Intent linkingToMarket(Context context, String url) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));/*from  w w w.j  a v a2  s. co m*/
    return intent;
}