List of usage examples for android.content Intent setDataAndType
public @NonNull Intent setDataAndType(@Nullable Uri data, @Nullable String type)
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 www . jav a 2 s.c o m }
From source file:Main.java
/** * Deprecated, use {@link norg.javiki.IntentBuilder.buildAppInstallIntent} instead * @param filePath//from ww w .j a va2 s . co m * @return */ @Deprecated public static Intent buildAppInstallIntent(File filePath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(filePath), "application/vnd.android.package-archive"); return intent; }
From source file:Main.java
public static void startSystemGallery(Activity activity, int resultCode) { Intent intent1 = new Intent(Intent.ACTION_PICK, null); intent1.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); activity.startActivityForResult(intent1, resultCode); }
From source file:Main.java
public static void inistallSoftware(Context context, String packageName) { String fileName = Environment.getExternalStorageDirectory() + "/" + packageName; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive"); context.startActivity(intent);// w ww. jav a2s .c om }
From source file:Main.java
public static void install(Context context, File file) { if (!file.exists()) { return;//from w w w. ja v a2s . co m } Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent); }
From source file:Main.java
public static void toTakePicture(int requestcode, Activity activity) { Intent intent = new Intent(Intent.ACTION_PICK, null); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); activity.startActivityForResult(intent, requestcode); }
From source file:Main.java
public static Intent selectPhoto() { Intent intent = new Intent(Intent.ACTION_PICK, null); intent.setDataAndType(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, "image/*"); return intent; }
From source file:Main.java
public static void playMedia(Context ctx, String link, String mime) { Uri path = Uri.parse(link);//from w w w .j a v a2 s . co m Intent intent = new Intent(Intent.ACTION_VIEW, path); intent.setDataAndType(path, "video/" + mime); ctx.startActivity(intent); }
From source file:Main.java
public static void playVideo(String url, Activity activity) { if (url != null && url.length() > 0) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse(url), "video/*"); activity.startActivity(intent);//from ww w . j ava2 s . c o m } }
From source file:Main.java
public static void installApp(Context context, File file) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//w w w. ja va2 s.c o m }