0

I am generated a folder name "tesApplication" and create a file name "testFile.csc" in it and store some date into that file. Now I want to open folder dir using new intent. I had try below code but did not work in my case any other way to achieve this.

Uri selectedUri = Uri.parse(fileNameString);
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(selectedUri, "text/csv");

    if (intent.resolveActivityInfo(getPackageManager(), 0) != null)
    {
        startActivity(intent);
    }
    else
    {
        // if you reach this place, it means there is no any file
        // explorer app installed on your device
    }
sofquestion 9
  • 167
  • 4
  • 12

1 Answers1

0

copy this in else

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