我像下面一样保存files
:
public boolean isExternalStorageAvailabled(Context context) {
String state = Environment.getExternalStorageState();
return state.equals(Environment.MEDIA_MOUNTED) && context.getExternalFilesDir(null) != null;
}
并且:
Utils utils = new Utils();
if (utils.isExternalStorageAvailabled(context)) {
return Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Android" + File.separator + "data" + File.separator + context.getPackageName() + File.separator + "files";
} else {
return context.getApplicationContext().getFilesDir().getAbsolutePath() + DOWNLOADS_DIR;
}
问题:
如何检查存储了哪些files
? true
是这样吗?
File path = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Android" + File.separator + "data" + File.separator + context.getPackageName() + File.separator + "files" + File.separator + (BATCH + fileName) + File.separator + "MMM" + File.separator + fileName);
File pathRoot = new File(context.getApplicationContext().getFilesDir().getAbsolutePath() + "/downloads/" +(BATCH + fileName) + "/MMM/" + fileName);
if (!path.exists() || !pathRoot.exists()) {
some code...
}