Back to project page SimpleReader.
The source code is released under:
Apache License
If you think the Android project SimpleReader listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.dreamteam.app.img; /*from w w w.j av a2 s . c o m*/ import java.io.File; import com.litesuits.android.log.Log; import android.content.Context; import android.os.Environment; public class FileCacheManager { public static String getChcheDir(Context context) { String result = null; if(hasSDCard()) { result = context.getExternalCacheDir().getAbsolutePath() + "/img"; new File(result).mkdirs(); }else { result = context.getCacheDir().getAbsolutePath() + "/img"; } return result; } private static boolean hasSDCard() { String status = Environment.getExternalStorageState(); if (!status.equals(Environment.MEDIA_MOUNTED)) { return false; } return true; } public static boolean deleteDirectory(String filePath) { if (null == filePath) { Log.e("FileCacheManager", "the parameter filePath is null, cancel delete"); return false; } File file = new File(filePath); if (file == null || !file.exists()) { Log.e("FileCacheManager", "the parameter filePath is not a file or dir, cancel delete"); return false; } if (file.isDirectory()) { File[] list = file.listFiles(); for (int i = 0; i < list.length; i++) { if (list[i].isDirectory()) { deleteDirectory(list[i].getAbsolutePath()); } else { list[i].delete(); } } } file.delete(); return true; } }