Android 如何打开带有特定相册或文件夹的默认多媒体资料应用程序?

Android 如何打开带有特定相册或文件夹的默认多媒体资料应用程序?,android,android-intent,gallery,android-gallery,Android,Android Intent,Gallery,Android Gallery,我在网上找到的每一个例子都是打开图库并从图库中获取图像。我的需要是我不想结果或图像到我的应用程序。我只想触发gallery应用程序,显示特定文件夹中的图像。我的应用程序有单独的文件夹来保存图像。我需要将用户直接导航到该路径。您可以这样尝试 Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = [Uri for your folder]; intent.setDataAndType(uri, "image/*"); startActiv

我在网上找到的每一个例子都是打开图库并从图库中获取图像。我的需要是我不想结果或图像到我的应用程序。我只想触发gallery应用程序,显示特定文件夹中的图像。我的应用程序有单独的文件夹来保存图像。我需要将用户直接导航到该路径。

您可以这样尝试

Intent intent = new Intent(Intent.ACTION_VIEW);
Uri uri = [Uri for your folder];
intent.setDataAndType(uri, "image/*");
startActivity(Intent.createChooser(intent, "Open [App] images"));

试试这个代码。它将在
storage/simulated/0/pictures/AppPics
下检索查看图片。您可以根据目录路径更改文件路径

File sdDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File file = new File(sdDir, "AppPics");

if (file.isDirectory()) 
    listFile = file.listFiles();
编辑:使用intent打开文件夹

Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.withAppendedPath(Uri.fromFile(file), "/AppPics"), "image/*");
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

谢谢,这正是我想要的。。如果我的问题合理的话,请投赞成票。。再次感谢..它会打开在空白图像中心显示“无缩略图”的图库。有什么建议吗?我已经尝试了此解决方案,但无法导航到特定文件夹并获得toast,就像找不到项目一样。谢谢,我已经尝试过了。。我不要挑肥拣瘦的。。这个答案解决了问题