how to make a folder in downloads folder and use it (reading and writing) in android 11 and up?
bard's code after getting permission:
private fun createFolderInDownloads() { val intent = Intent(Intent.ACTION_CREATE_DOCUMENT) intent.addCategory(Intent.CATEGORY_OPENABLE) intent.type = "directory/*" val downloadsUri = File( Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS) .absolutePath + "/new folder" ) intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, downloadsUri) // Start activity for result to get user interaction startActivityForResult(intent, REQUEST_CREATE_FOLDER_CODE) } downloadsUri is printing the path i want but it didn't work (it doesn't make a file or throw an error)
downloadsUri is printing the path i want but it didn't work? Then what should happen? What does not work?intent.type = "directory/*"That is not usable for ACTION_CREATE_DOCUMENT which is for creating files.and use it (like telegram)And how is it used in Telegram? How would we know what you are referring?Then what should happen? What does not work?it doesn't make a file or throw an errorAnd how is it used in Telegram? How would we know what you are referring?i edited it