List of usage examples for android.net Uri fromFile
public static Uri fromFile(File file)
From source file:Main.java
public static void installAPK(Context context, File file) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent);//from w ww . ja v a 2 s .co m }
From source file:Main.java
public static void installApk(Activity activity, String path) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(path)), "application/vnd.android.package-archive"); activity.startActivity(intent);/* www. ja v a2 s .c om*/ }
From source file:Main.java
public static void installApk(Context context, String filename) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(filename)), "application/vnd.android.package-archive"); context.startActivity(intent);/*from w w w.ja va2 s. co m*/ }
From source file:Main.java
public static void installApk(Context context, String filePath) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(filePath)), "application/vnd.android.package-archive"); context.startActivity(intent);/* w ww . j av a 2s . co m*/ }
From source file:Main.java
public static void installApk(Context context, File apkFile) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(apkFile), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(intent);//from w w w . j a v a 2s .c o m }
From source file:Main.java
public static void installAPK(String fileName, Context context) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive"); context.startActivity(intent);//from w w w. j a v a 2 s .c o m }
From source file:Main.java
public static void scanPhotos(String filePath, Context context) { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri uri = Uri.fromFile(new File(filePath)); intent.setData(uri);//w w w .j a va 2s. c om context.sendBroadcast(intent); }
From source file:Main.java
public static void scanPic(Context context, File file) { Intent mediaScanIntent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri contentUri = Uri.fromFile(file); mediaScanIntent.setData(contentUri); context.sendBroadcast(mediaScanIntent); }
From source file:Main.java
public static void insertImageToPhotoAlbum(Context context, String fileName) { Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE); Uri uri = Uri.fromFile(new File(fileName)); intent.setData(uri);//w w w.j a va 2 s . c o m context.sendBroadcast(intent); }
From source file:Main.java
public static void scanDirAsync(Context ctx, String dir) { Intent scanIntent = new Intent("android.intent.action.MEDIA_SCANNER_SCAN_DIR"); scanIntent.setData(Uri.fromFile(new File(dir))); ctx.sendBroadcast(scanIntent);/* w w w. j av a2 s . co m*/ }