How to open a folder in android

0

I wanted to open a directory on android, so I tried:

 public void openFolder()
    {
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
        + "/Pictures/");
    intent.setDataAndType(uri, "text/csv");
    startActivity(Intent.createChooser(intent, "Open folder"));
    }

But it's time to call "unable to find application to perform this action"

I just wanted to open the directory

    
asked by anonymous 21.01.2015 / 15:13

2 answers

1

1 - Does this folder exist?

2 - Do you have these permissions? <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />

3 - Are you using an AVD or Physical Device to run the application?

4 - In both of the above, whatever your answer, is there a program like: solid explorer, root explorer?

5 - This was to work:

public void openFolder()
{
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
    + "/Pictures/");
intent.setDataAndType(uri, "text/csv");
startActivity(Intent.createChooser(intent, "Abrindo pasta"));
}

A MIME type "*/*" instead of "text/csv" , would also solve.

    
22.01.2015 / 00:51
0

Come on, check this other way (see if it works).

public void abrirDiretorio()
          {
            File pasta = new File(Environment.getExternalStorageDirectory().getPath()
               + "/Pictures/");
            Uri local = Uri.fromFile(pasta);
            Intent intent = new Intent();
            intent.setAction(android.content.Intent.ACTION_VIEW);
            intent.setData(local);
            startActivityForResult(intent, 1);
          }
    
21.01.2015 / 23:43