0
我使用下面的代码在图片文件夹中创建文件夹并烘烤路径。 但我没有提到在android清单中写入外部存储的文件夹。创建文件夹时出错
java.io.File file = new java.io.File (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),"College");
if(!file.exists())
{
if(file.mkdir())
{
String f =file.getAbsolutePath();
Toast.makeText(getApplicationContext(),f,Toast.LENGTH_LONG).show();
}
else {
Toast.makeText(getApplicationContext(),"File Not Created",Toast.LENGTH_LONG).show();
}
}
请帮助我的问题
请您menifest检查许可<使用权限android:name =“android.permission.WRITE_EXTERNAL_STORAGE”/> – rahultheOne
我已经添加了权限 – Pragadees
使用'file.mkdirs()'而不是'file.mkdir()' –