Open folder on card

前端 未结 2 733
耶瑟儿~
耶瑟儿~ 2021-01-07 00:55

I thought this was something really simple, but it\'s giving me more work than the rest of the whole app.

I just want a button to open the \"Downloaded Files\" folde

2条回答
  •  悲&欢浪女
    2021-01-07 01:37

    wow.. Finally!! After many things I tried, the only way it worked was by wrapping the URI string into a File first, and then do a Uri.fromFile:

    File file = new File(Environment.getExternalStorageDirectory().getPath() + "/MyDownloadedFiles/");
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(file), "*/*");
    startActivity(Intent.createChooser(intent, getString(R.string.action_downloaded)));
    

提交回复
热议问题