我正在尝试在我的android模拟器上创建一个目录但是我不能这样做,我已经拥有了manifest write_storage的权限,并且我没有得到任何错误,但mkdir()返回false,我验证外部存储是否也可写它是,它在物理设备上工作我的代码:
/// Cria uma nova pasta para colocar o backup
File direct = new File(Environment.getExternalStorageDirectory(),
"/Financas RW Backup");
try {
if (!direct.exists()) {
if(isExternalStorageWritable()&&isExternalStorageReadable()) {
if( direct.mkdir()) {
fachada.showMessage(ExportImportDB.this," Criado");
}else{
fachada.showMessage(ExportImportDB.this," Não Criado");
}
}
}
} catch (Exception e) {
fachada.showMessage(this, e.toString());
}
Run Code Online (Sandbox Code Playgroud)