【发布时间】:2013-12-26 16:00:02
【问题描述】:
我直接在 Android 上创建一个 excel 文件。代码运行良好,我可以验证 .xls 是否已创建,并且可以从有根手机中检查它的内容。 但是,我想将 excel 文件保存在与项目本身不同的文件夹中(即 /data/data/mypackage/files/)。我想将它保存在普通的电话文档中,例如“/storage/sdcard0/Documents/test.xls”。尝试将 .xls 文件保存到该文件夹时,我收到一条消息“权限被拒绝”。
如何访问这些文件夹?
我在这里创建excel文件
WriteExcel test = new WriteExcel();
test.setOutputFile("/data/data/com.example.interfaz/files/test.xls"); // here is where I want to save the file to "/storage/sdcard0/Documents/test.xls"
try {
test.write();
} catch (WriteException e) {
e.printStackTrace();
} catch (IOException e) {
Toast.makeText(getBaseContext(), e.toString(), Toast.LENGTH_LONG).show();
}
【问题讨论】: