List of usage examples for android.net Uri fromFile
public static Uri fromFile(File file)
From source file:Main.java
public static void installSoftwareByAPK(Context context, String filePath) { Uri uri = Uri.fromFile(new File(filePath)); Intent installIntent = new Intent(Intent.ACTION_VIEW); installIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); installIntent.setDataAndType(uri, "application/vnd.android.package-archive"); context.startActivity(installIntent); }
From source file:Main.java
public static void callText(Context context, String path) { Intent intent = new Intent(); intent.setDataAndType(Uri.fromFile(new File(path)), "text/plain"); context.startActivity(intent);// w w w . jav a 2 s . co m }
From source file:Main.java
public static Uri getFileUri(String filePath) { return Uri.fromFile(new File(filePath)); }
From source file:Main.java
public static void callImage(Context context, String path) { Intent intent = new Intent(); intent.setDataAndType(Uri.fromFile(new File(path)), "image/*"); context.startActivity(intent);// www. j a va 2 s. co m }
From source file:Main.java
public static void updateSys(Context context, String filePath) { Uri iru = Uri.fromFile(new File(filePath)); Intent inten = new Intent(Intent.ACTION_VIEW); inten.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); inten.setDataAndType(iru, "application/vnd.android.package-archive"); context.startActivity(inten);//from w w w . j ava 2s . c o m }
From source file:Main.java
public static void scanMediaFileToGallery(Context context, String path) { File file = new File(path); Uri uri = Uri.fromFile(file); Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, uri); context.sendBroadcast(intent);//from w w w. j a v a 2 s .co m }
From source file:Main.java
/** Create a file Uri for saving an image*/ public static Uri getOutputMediaFileUri(long fileName) { return Uri.fromFile(getOutputMediaFile(Long.toString(fileName))); }
From source file:Main.java
public static Intent getInstallIntent(File apkFile) { Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(apkFile.getAbsolutePath())), "application/vnd.android.package-archive"); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); return intent; }
From source file:Main.java
public static void install(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);/*from ww w. j a v a 2 s . c o m*/ }
From source file:Main.java
public static void install(Context context, String mUrl) { Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(mUrl)), "application/vnd.android.package-archive"); context.startActivity(intent);/*w w w . ja v a2 s . c o m*/ }