android - 我无法在 android 11 上创建文件夹或共享图像
问题描述
如何在 android 11 上创建文件夹或共享图像?这是保存文件或图像的第一个代码:
@Override
protected String doInBackground(String... args) {
// TODO Auto-generated method stub
path = args[0];
String idStr = path.substring (path.lastIndexOf ('/') + 1);
File filepath = Environment.getExternalStorageDirectory ();
File dir = new File (filepath.getAbsolutePath () + "/MyDownloads/");
dir.mkdirs ();
String fileName = idStr;
Ion.with (getApplicationContext ()).load (path)
.write (new File (dir, fileName));
return null;
}
这是第二个分享:
@Override
protected String doInBackground(String... args) {
// TODO Auto-generated method stub
path = args[0];
String idStr = path.substring (path.lastIndexOf ('/') + 1);
File filepath = Environment.getExternalStorageDirectory ();
File dir = new File (filepath.getAbsolutePath () + "/MyDownloads/");
dir.mkdirs ();
String fileName = idStr;
file = new File (dir, fileName);
Ion.with (getApplicationContext ()).load (path)
.write (file);
return null;
}
请我等待你的帮助。