List of usage examples for android.content Context getExternalFilesDir
@Nullable public abstract File getExternalFilesDir(@Nullable String type);
From source file:Main.java
public static File getAppStorageDir(Context context) { File file = context.getExternalFilesDir(Environment.DIRECTORY_DOCUMENTS); if (!file.mkdirs()) { }//from w w w. j ava 2 s . c om return file; }
From source file:Main.java
public static String getPicStorePath(Context ctx) { File file = ctx.getExternalFilesDir(null); if (!file.exists()) { file.mkdir();/*from ww w .j a v a 2 s .com*/ } File imageStoreFile = new File(file.getAbsolutePath() + "/mq"); if (!imageStoreFile.exists()) { imageStoreFile.mkdir(); } return imageStoreFile.getAbsolutePath(); }
From source file:Main.java
public static File getFilesDir(Context context) { File targetDir = context.getExternalFilesDir(null); if (targetDir == null || !targetDir.exists()) { targetDir = context.getFilesDir(); }/*from w ww .j a va2 s. c om*/ return targetDir; }
From source file:Main.java
private static String getExternalStoragePathByContext(String path, Context context) { File dirPath = context.getExternalFilesDir(path); if (dirPath == null) { dirPath = new File(context.getExternalFilesDir(null).getAbsolutePath() + "/" + path + "/"); }//from w ww .j a va2s .c o m if (!dirPath.exists()) { dirPath.mkdir(); } return dirPath.getAbsolutePath(); }
From source file:Main.java
public static String getPicStorePath(Context ctx) { File file = ctx.getExternalFilesDir(null); if (file == null) { file = ctx.getFilesDir();//from www .j av a2 s . c o m } if (!file.exists()) { file.mkdir(); } File imageStoreFile = new File(file.getAbsolutePath() + "/mq"); if (!imageStoreFile.exists()) { imageStoreFile.mkdir(); } return imageStoreFile.getAbsolutePath(); }
From source file:Main.java
public static String getVideoFilePath(Context context) { final File dir = context.getExternalFilesDir(null); return (dir == null ? "" : (dir.getAbsolutePath() + "/")) + System.currentTimeMillis() + ".mp4"; }
From source file:Main.java
public static String getSendDir(Context context) { File fileDir = context.getExternalFilesDir(null); String dir = null;//from w w w .j a v a 2 s .co m if (fileDir != null) { dir = fileDir.getAbsolutePath(); } else { dir = context.getFilesDir().getAbsolutePath(); } dir += "/mtc/bgimage/"; fileDir = new File(dir); fileDir.mkdirs(); return dir; }
From source file:Main.java
public static String getExternalFullPath(Context context, String fileName) { File dir = context.getExternalFilesDir(null); if (dir == null) { return null; }/*from www. j a v a 2 s . c om*/ return dir.getAbsolutePath() + "/" + fileName; }
From source file:com.granita.contacticloudsync.log.ExternalFileLogger.java
public static File getDirectory(Context context) { return context.getExternalFilesDir(null); }
From source file:Main.java
public static boolean checkFileExists(Context context, String filename) { File file = new File(context.getExternalFilesDir(null), filename); return file.exists(); }