0

I am using FFMPEG to make a video editor. I stuck when selecting a folder:

1/ I will show "File Manager" to user. They can choose a folder then return a path. How can choose a folder and get its path. For example: /sdcard/videokit/.

enter image description here

Here is my code, I must choose a mp4 file (not a folder I want).

public void openFolder()
{
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
        + "/sdcard/");
    intent.setDataAndType(uri, "folder|video/mp4");
    startActivityForResult(Intent.createChooser(intent, "Select Folder"),PICK_VIDEO_OUTPUT_REQUEST);
}

Thank you in advance!

Luong Truong
  • 1,953
  • 2
  • 27
  • 46
  • Your 1) is not clear. What can change? Isn't it a fixed path? – Alex Cohn Jul 16 '14 at 04:28
  • 1
    2) is answered here: _[Get filename and path from uri from mediastore](http://stackoverflow.com/questions/3401579/get-filename-and-path-from-uri-from-mediastore)_ – Alex Cohn Jul 16 '14 at 04:32
  • My 1) is that I will show "File Manager". User can choose a folder and it will return a folder path for me. Thank you for your comment, I will edit my post to make it clear. – Luong Truong Jul 16 '14 at 04:34

1 Answers1

0

No, you cannot use Intent to choose folder in Android. You need a dialog of your own. Luckily, there are plenty ready to use code samples available, e.g. How to select folder in android?.

Community
  • 1
  • 1
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307