List of usage examples for android.os Environment getExternalStorageDirectory
public static File getExternalStorageDirectory()
From source file:Main.java
public static String getAppDirectoryString() { return Environment.getExternalStorageDirectory().getPath() + File.separator + "LocalMangaViewer" + File.separator;//from ww w .j av a2 s.c om }
From source file:Main.java
public static String getSdCardPath() { // In this method,Lenovo pad return StorageDirectory,not "/mnt/sdcard1" String sdPath = null;/*from w w w. j a va 2 s. co m*/ if (checkSdCardIsExist()) { sdPath = Environment.getExternalStorageDirectory().getAbsolutePath(); } return sdPath.toString(); }
From source file:Main.java
public static File getTempFilePath(Context context, String str_profile) { // it will return /sdcard/image.tmp final File path = new File(Environment.getExternalStorageDirectory(), context.getPackageName()); if (!path.exists()) { path.mkdir();//ww w .ja va 2 s . com } return new File(path, str_profile); }
From source file:Main.java
/** * @return Directory for file storage while downloading *///from w w w. j ava 2 s .c om public static File getPath() { File dir = new File(Environment.getExternalStorageDirectory() + "/Videos"); if (!dir.exists()) { dir.mkdir(); } return dir; }
From source file:Main.java
@SuppressWarnings("deprecation") public static long getTotalExternalMemorySize() { if (externalMemoryAvailable()) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return totalBlocks * blockSize; } else {//from w w w . ja v a2 s . c om return -1; } }
From source file:Main.java
public static String getRootByApi() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { File file = Environment.getExternalStorageDirectory(); if (file == null) return null; String path = file.getAbsolutePath(); if (isValidRoot(path)) return path; }/*from w w w . ja v a2s . co m*/ return null; }
From source file:Main.java
public static void inistallSoftware(Context context, String packageName) { String fileName = Environment.getExternalStorageDirectory() + "/" + packageName; Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive"); context.startActivity(intent);/*ww w . jav a 2 s. c o m*/ }
From source file:Main.java
public static long getTotalExternalMemorySize() { if (externalMemoryAvailable()) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long totalBlocks = stat.getBlockCount(); return totalBlocks * blockSize; } else {/* www .j av a 2 s . c o m*/ return -1; } }
From source file:Main.java
@SuppressWarnings("deprecation") public static long getAvailableExternalMemorySize() { if (externalMemoryAvailable()) { File path = Environment.getExternalStorageDirectory(); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); return availableBlocks * blockSize; } else {// w w w. j av a2 s . c om return -1; } }
From source file:Main.java
public static void createNarDirOnSDCard() { File narDir = new File(Environment.getExternalStorageDirectory(), "nar"); if (narDir.exists() && narDir.isDirectory()) return;//from w w w .j a va 2 s . c o m boolean success = narDir.mkdirs(); if (success == false) Log.d(TAG, "nar folder creation failed"); }