我有这个方法,但为什么无法在图片文件夹中创建目录?
private void CreateDirectoryForPictures()
{
App._dir = new File(
Android.OS.Environment.GetExternalStoragePublicDirectory(
Android.OS.Environment.DirectoryPictures), "CameraAppDemo");
if (!App._dir.Exists())
{
App._dir.Mkdirs();
}
if (!App._dir.Exists())
{
Toast.MakeText(this, "Directory not created", ToastLength.Short).Show();
}
else
{
Toast.MakeText(this, "Directory created", ToastLength.Short).Show();
}
}
答案 0 :(得分:3)
您是否在清单中添加了WRITE_EXTERNAL_STORAGE权限?