Victor Escalante
Victor Escalante

Reputation: 62

how access folder specific app android studio

I have the following code with which to access a specific folder of the external storage, the question is how I can do the same but for a folder of my internal storage application

        val rootPath = "content://com.android.externalstorage.documents/document/primary:"
            val samPath = Uri.parse("$rootPath${Environment.DIRECTORY_DOWNLOADS}%2fajua")    
            val REQUEST_CODE_PICK_FILE = 1
            val intent = Intent(Intent.ACTION_GET_CONTENT)
            intent.type = "image/*"    //specify file type
            intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, samPath)    
            startActivityForResult(intent, REQUEST_CODE_PICK_FILE)

Upvotes: 1

Views: 571

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007554

I have the following code with which to access a specific folder of the external storage

Not reliably. Please do not assume that you can hand-assemble a Uri that will work.

the question is how I can do the same but for a folder of my internal storage application

Sorry, but the Storage Access Framework UI has no access to your app's portion of internal storage.

Upvotes: 2

Related Questions