Code example for File

Methods: exists, mkdir

0
	 * @param context Application context 
	 * @return Cache {@link File directory} 
	 */ 
	public static File getIndividualCacheDirectory(Context context) {
		File cacheDir = getCacheDirectory(context);
		File individualCacheDir = new File(cacheDir, INDIVIDUAL_DIR_NAME);
		if (!individualCacheDir.exists()) {
			if (!individualCacheDir.mkdir()) {
				individualCacheDir = cacheDir;
			} 
		} 
		return individualCacheDir;
	} 
 
	/** 
	 * Returns specified application cache directory. Cache directory will be created on SD card by defined path if card 
	 * is mounted and app has appropriate permission. Else - Android defines cache directory on device's file system. 
	 * 
	 * @param context  Application context 
	 * @param cacheDir Cache directory path (e.g.: "AppCacheDir", "AppDir/cache/images") 
	 * @return Cache {@link File directory}