List of usage examples for android.net Uri fromFile
public static Uri fromFile(File file)
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 jumpToSystemInstallApkActivity(Context context, String apkPath) { Intent intent = new Intent("android.intent.action.VIEW"); intent.setDataAndType(Uri.fromFile(new File(apkPath)), "application/vnd.android.package-archive"); context.startActivity(intent);/* w w w .j av a 2 s . c o m*/ }
From source file:Main.java
public static void installAPK(Context context, String apkFile) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(apkFile)), "application/vnd.android.package-archive"); context.startActivity(intent);/*from w w w . j av a 2 s . c om*/ }
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 w w w .ja v a 2 s . c o m }
From source file:Main.java
public static Intent makeTakePicturesIntent(File file) { Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); return 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 w w w .j a v a 2 s.co m*/ }
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 getInstallApkIntent(File file) { Intent intent = new Intent(); intent.setFlags(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 void installApk(Context context, File file) { if (context != null && isFileExists(file)) { Uri uri = Uri.fromFile(new File(file.getAbsolutePath())); Intent installIntent = new Intent(); installIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); installIntent.setAction(Intent.ACTION_VIEW); String type = "application/vnd.android.package-archive"; installIntent.putExtra("loadapk", "loadapk"); installIntent.setDataAndType(uri, type); context.startActivity(installIntent); }/*from w ww. j a v a 2s.co m*/ }
From source file:Main.java
/** * Convert a file to a Uri//from w w w .j a v a 2 s . co m * @param file * @return */ public static Uri convertFileToUri(File file) { if (file == null) { return null; } Uri imgUri = Uri.fromFile(file); return imgUri; }