List of usage examples for android.content Intent setAction
public @NonNull Intent setAction(@Nullable String action)
From source file:Main.java
public static void installApk(Context context, Uri file) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(file, "application/vnd.android.package-archive"); context.startActivity(intent);/* w w w .j av a2s. co m*/ }
From source file:Main.java
public static Intent getPhotoGalleryIntent(Uri photoUri) { Intent galleryIntent = new Intent(); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_GET_CONTENT); addPhotoPickerExtras(galleryIntent, photoUri); return galleryIntent; }
From source file:Main.java
public static void installApk(Context context, 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"); context.startActivity(intent);//from w ww . ja va2 s. c om }
From source file:Main.java
public static void viewUriForMimeType(Context context, Uri uri, String type) { Intent intent; intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); if (type == null) intent.setData(uri);/*from w w w. j a v a2 s. co m*/ else intent.setDataAndType(uri, type); context.startActivity(intent); }
From source file:Main.java
public static Intent getInstallIntent(File file) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); return intent; }
From source file:Main.java
public static Intent showOpenTypeDialog(String param) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); Uri uri = Uri.fromFile(new File(param)); intent.setDataAndType(uri, "*/*"); return intent; }
From source file:Main.java
private static Intent getAllIntent(String filePath) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); Uri uri = Uri.fromFile(new File(filePath)); intent.setDataAndType(uri, "*/*"); return intent; }
From source file:Main.java
public static void installBySys(Context context, File f) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(f), "application/vnd.android.package-archive"); context.startActivity(intent);//from w ww . j av a2 s .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 InstallApk(Context context, String path) { Intent intent = new Intent(); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction(android.content.Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive"); context.startActivity(intent);//from w w w .j a v a 2 s.c o m }