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 installAPK(Context context, File apkFile) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive");
    context.startActivity(intent);/*from  www  . j  a va 2s.com*/
}

From source file:Main.java

/**  -----------------------------------------------------------------------  Play Store -- */

public static Intent newOpenStoreIntent(String packageName) {
    return new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName));
}

From source file:Main.java

public static void uninstallApk(Context context, String packageName) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    Uri data = Uri.parse("package:" + packageName);
    intent.setData(data);// w w w  .  jav  a  2  s  . c  om
    context.startActivity(intent);
}

From source file:Main.java

public static void install(Context context, File uriFile) {
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(uriFile), "application/vnd.android.package-archive");
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from  ww w . ja v a  2  s  .  com
}

From source file:Main.java

public static void sendSMS(Context context, String tel, String message) {
    Uri uri = Uri.parse("smsto:" + tel);
    Intent sendIntent = new Intent(Intent.ACTION_VIEW, uri);
    sendIntent.putExtra("sms_body", message);
    context.startActivity(sendIntent);//from w ww . j a va2s.  c o  m
}

From source file:Main.java

public static void openMark(Context context) {
    Uri uri = Uri.parse("market://details?id=" + context.getPackageName());
    Intent intent = new Intent(Intent.ACTION_VIEW, uri);
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(intent);//from ww w. ja va2s  .c o  m
}

From source file:Main.java

public static Intent getAllIntent(String param) {

    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(Intent.ACTION_VIEW);
    Uri uri = Uri.fromFile(new File(param));
    intent.setDataAndType(uri, "*/*");
    return intent;
}

From source file:Main.java

public static void jumpTo(Activity activity, String url) {
    Intent intent = new Intent();
    intent.setAction(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(url));//from   w w  w.  j a  va 2 s. c  om
    activity.startActivity(intent);
}

From source file:Main.java

public static void installApk(Context context, File file) {
    Uri packageUri = Uri.fromFile(file);
    Intent intent = new Intent(Intent.ACTION_VIEW, packageUri);
    intent.setDataAndType(packageUri, "application/vnd.android.package-archive");
    context.startActivity(intent);//from  w w w  .j  a v  a2s . c o m
}

From source file:Main.java

private static Intent getApkFileIntent(File file) {
    Intent intent = new Intent();
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setAction(android.content.Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
    return intent;
}