Issue
I have tried so many answers related to this question but didn't work any of them. this my code but it didn't open the myFile folder. Please help me to resolve this issue
val intent = Intent(Intent.ACTION_GET_CONTENT)
val uri = Uri.parse(
(Environment.getExternalStorageDirectory().absolutePath) + "/myFile/")
intent.setDataAndType(uri, "*/*")
startActivityForResult(intent, WRITE_ACCESS_CODE)
Solution
This code may help you:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(intent, YOUR_RESULT_CODE);
If you want to open a specific folder:
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setDataAndType(Uri.parse(Environment.getExternalStorageDirectory().getPath()
+ File.separator + "myFolder" + File.separator), "file/*");
startActivityForResult(intent, YOUR_RESULT_CODE);
Answered By - Cardstdani
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.