我目前有一个简单的代码,我将CSV文件保存在一个文件夹中,根据我的android studio监视器,我成功将该文件保存在一个文件夹中,我无法访问哪个是" / storage /emulated/0/Download/myfolder/552.csv"
File path =new
File(Environment.getExternalStoragePublicDirectory(Environment. +
DIRECTORY_DOWNLOADS),"myfolder");
System.out.println(path);
if (!path.exists()){
path.mkdir();
}
File mypath=new File(path,(editSesion.getText().toString()+".csv"));
FileWriter mFile = new FileWriter(mypath,true);
CSVWriter writer = new CSVWriter(new FileWriter(mypath));
System.out.println(mypath);
有没有办法获得更常用的文件夹的路径?
答案 0 :(得分:0)
/ storage / emulated / 0 / Download / 是手机存储空间的“下载”文件夹。
您期望的共同目录是多少?
答案 1 :(得分:0)
请添加 / (正斜杠),例如 myfolder /
File(Environment.getExternalStoragePublicDirectory(Environment. +
DIRECTORY_DOWNLOADS),"myfolder");
改为
File(Environment.getExternalStoragePublicDirectory(Environment. +
DIRECTORY_DOWNLOADS),"myfolder/");