List of usage examples for android.net Uri fromFile
public static Uri fromFile(File file)
From source file:Main.java
public static Uri getImageUri(String path) { return Uri.fromFile(new File(path)); }
From source file:Main.java
public static Uri uriFromPath(String filePath) { return Uri.fromFile(new File(filePath)); }
From source file:Main.java
public static Uri getFileUri(File file) { return Uri.fromFile(file); }
From source file:Main.java
public static Uri uriFromFile(File file) { return Uri.fromFile(file); }
From source file:Main.java
static boolean isVideo(File file) { Uri uri = Uri.fromFile(file); String type = MimeTypeMap.getSingleton() .getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(uri.toString())); if (type == null) return false; else//from ww w .j a v a 2 s . c o m return (type.toLowerCase().startsWith("video/")); }
From source file:Main.java
public static boolean isPicture(File file) { Uri uri = Uri.fromFile(file); String type = MimeTypeMap.getSingleton() .getMimeTypeFromExtension(MimeTypeMap.getFileExtensionFromUrl(uri.toString())); if (type == null) return false; else//w w w. j a v a2 s .c o m return (type.toLowerCase().startsWith("image/")); }
From source file:Main.java
public static String returnCamera(File photo) { if (photo == null) return null; Uri originalUri = Uri.fromFile(photo); return originalUri.toString().replace("file://", ""); }
From source file:Main.java
public static Uri getUriFromPath(String FilePath) { File f = new File(FilePath); f.setReadable(true, false);/*from www . ja va 2s . c o m*/ Uri returnUri = Uri.fromFile(f); return returnUri; }
From source file:Main.java
public static void installApk(Context context, File file) { Uri packageUri = Uri.fromFile(file); Intent intent = new Intent(Intent.ACTION_VIEW, packageUri); intent.setDataAndType(packageUri, "application/vnd.android.package-archive"); context.startActivity(intent);//from ww w.j av a2 s .c o m }
From source file:Main.java
public static void sendIntent(Context context, String url) { sendIntent(context, Uri.fromFile(new File(url))); }