i'm trying to make directory using these lines of code but it's deprecated method and the directory is't created and my targetSdkVersion is 29
File file = new File(Environment.getExternalStorageDirectory()+"/"+Constants.APP_NAME);
file.mkdir();
i try these lines but it's created the directory inside Android/data/com.example.application1/appName
File file = new File(mContext.getExternalFilesDir(null),Constants.APP_NAME);
but i need to make directory to save my files at the top level of internal storage device. which code can i use to save my directory in the top level of root directory ?
but i need to make directory to save my files at the top level of internal storage device
That is not supported directly on Android 10 (by default) or Android R+ (for all apps).
which code can i use to save my directory in the top level of root directory ?
Use ACTION_OPEN_DOCUMENT_TREE
and let the user choose where the user wants to place the user's files on the user's device.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.