List of usage examples for android.os Environment getExternalStorageDirectory
public static File getExternalStorageDirectory()
From source file:Main.java
/** * /sdcard/*from w w w . j a va 2s.c o m*/ * * @return */ public static String getExternalStorePath() { if (isExistExternalStore()) { return Environment.getExternalStorageDirectory().getAbsolutePath(); } return null; }
From source file:Main.java
public static void createNoMedia() { //Create .nomedia in audio folder File dir = new File(Environment.getExternalStorageDirectory() + "/FranqInterface/audio"); File nomediaFile = new File(dir, ".nomedia"); try {// ww w .j a v a 2s . c om nomediaFile.createNewFile(); } catch (IOException e) { e.printStackTrace(); } }
From source file:Main.java
public static File getExternalStorageDir(String dirName) { File file = null;//from www .j a v a 2s .c o m if (dirName == null) { file = Environment.getExternalStorageDirectory(); } else { file = new File(Environment.getExternalStorageDirectory(), dirName); } if (!file.exists()) { file.mkdirs(); } return file; }
From source file:Main.java
public static boolean isSdCard(File file) { try {//w w w . j a v a2 s . co m return (file.getCanonicalPath().equals(Environment.getExternalStorageDirectory().getCanonicalPath())); } catch (IOException e) { return false; } }
From source file:Main.java
public static void RenameFileToOldPath(String newpath) { String path = newpath;/* ww w .j a va 2 s . c om*/ String old = path + ".ck"; File sdcard = Environment.getExternalStorageDirectory(); File from = new File(sdcard, newpath); File to = new File(sdcard, old); from.renameTo(to); }
From source file:Main.java
public static final String getContentImagePath(String fileName) { String path = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + CONTENTS_FOLDER_NAME + File.separator + "Images" + File.separator + fileName; return path;//from w w w . jav a 2 s . c o m }
From source file:Main.java
public static String getExternalPath() { String ext = Environment.getExternalStorageState(); if (ext.equals(Environment.MEDIA_MOUNTED)) { return Environment.getExternalStorageDirectory().getAbsolutePath(); } else {/*from ww w .ja va 2 s. c om*/ return null; } }
From source file:Main.java
public static File getDir() { String rootDir = ""; if (Environment.isExternalStorageEmulated()) { rootDir = Environment.getExternalStorageDirectory().toString() + "/" + Environment.DIRECTORY_DCIM; } else {/*from w w w .ja va 2s.c o m*/ rootDir = Environment.getDataDirectory().toString() + "/" + Environment.DIRECTORY_DCIM; } File imageDirectory = new File(rootDir); if (!imageDirectory.exists()) { imageDirectory.mkdirs(); } return imageDirectory; }
From source file:Main.java
public static String getStoragePath() { if (!isCardExist()) return null; File path = Environment.getExternalStorageDirectory(); if (path != null && !TextUtils.isEmpty(path.getAbsolutePath())) { return path.getAbsolutePath(); } else {/*from ww w .j av a 2 s .co m*/ return null; } }
From source file:Main.java
public static String getMainSDCardRoot() { return Environment.getExternalStorageDirectory().getPath(); }