How can create folder or share images on android 11 ? This the First code for save file or image:
@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;
}
And this is the Second for share:
@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;
}
Please I am waiting your help.