java在Android中通过单击打开特定文件夹
我正在使用下面的代码打开由我的应用程序创建的文件夹,但它不工作,尽管我是从Trying open a specific folder in 安卓 using intent获得它的
public void openFolder() {
SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(this);
String pa = sharedPreferences.getString("path", "");
Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = Uri.parse(pa);
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "Open folder"));
}
当我使用Action_View时,它会显示除FileManager
之外的所有可能的方法,在ACTION_GET_CONTENT
中,我进入SAF模式,选择存储,然后选择特定的文件夹
它将如何直接打开我定义的URI文件夹?还有别的办法吗
# 1 楼答案
这应该有用