androidfilefile-location

How can I open file location to show a file?


I am making video player app. And I want to add option like, when user taps,it opens default file manager to show this video file's location.

Here is sample from Windows OS enter image description here

Any help would be appreciated !


Solution

  • You can do this by this method.

    public void open_Folder(String location)
    {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
         + File.separator+ location + File.separator);
    intent.setDataAndType(uri, "set your data type");
    startActivity(Intent.createChooser(intent, "Select file manager app."));
    }