2023-02-24 AndroidR app 调用系统文件管理器打开指定路径目录

一、打开某个目录代码,在androidR上可以用,旧的方法在androidR上面不生效,不能到指定目录。

    public void openAssignFolder(String dir)//openAssignFolder("CameraPhotos");
    {
        Uri uri = 
        Uri.parse("content://com.android.externalstorage.documents/document/primary:"+dir);
        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        intent.setType("*/*");
        intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, uri);
        startActivity(intent);
        //startActivityForResult(intent, 1);
    }

二、参考文章

Android 系统文件浏览器_android 文件浏览器_钟情短发姑娘的博客-CSDN博客系统文件浏览器https://blog.csdn.net/qq_36488374/article/details/126955385

Android 调用系统文件管理器打开指定路径目录 | 码农家园网上找到普遍都是这样:[cc]Intent intent = new Intent(Intent.ACTION_GET_CONTENT);intent.addCategory(Intent.CATEGORY_OPENABLE);intent.setDataAndType(...https://www.codenong.com/q1010000021126126/

猜你喜欢

转载自blog.csdn.net/qq_37858386/article/details/129205135