Code example for File

Methods: isDirectory, mkdirs

0
			return GetExternalCacheDirAccessorFroyo.getExternalCacheDir(context);
		final File ext_storage_dir = Environment.getExternalStorageDirectory();
		if (ext_storage_dir != null && ext_storage_dir.isDirectory()) {
			final String ext_cache_path = ext_storage_dir.getAbsolutePath() + "/Android/data/"
					+ context.getPackageName() + "/cache/";
			final File ext_cache_dir = new File(ext_cache_path);
			if (ext_cache_dir.isDirectory() || ext_cache_dir.mkdirs()) return ext_cache_dir;
		} 
		return null; 
	} 
 
	public static File getExternalStoragePublicDirectory(final String type) {
		if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.FROYO)
			return GetExternalStoragePublicDirectoryAccessorFroyo.getExternalStoragePublicDirectory(type);
		else { 
			final File ext_dir = Environment.getExternalStorageDirectory();
			if (ext_dir == null || type == null) return null;
			return new File(ext_dir, type);
		} 
	}