应用程序数据存储在手机内存中,即使是android安装位置也是" preferExternal"并启用" WRITE_EXTERNAL_STORAGE"清单中的android权限。根据文档,我必须使用" userDirectory"或" documentsDirectory"。即使无法将应用数据存储到外部存储器中。怎么做?
答案 0 :(得分:0)
用这种方式获取路径......
//Environment.getExternalStorageDirectory().xyzpaths()
// get path like this
File log = new File(Environment.getExternalStorageDirectory(), "Log.txt");
try {
out = new BufferedWriter(new FileWriter(log.getAbsolutePath(), false));
out.write(new Date().toString());
out.write(" : \n");
} catch (Exception e) {
Log.e(TAG, "Error opening Log.", e);
}