Android显示特定文件夹中的图像

Android显示特定文件夹中的图像,android,android-studio,gallery,android-image,Android,Android Studio,Gallery,Android Image,我需要显示SD卡上特定文件夹中的图像。 我想用一个按钮来显示图库。但是,我不知道怎么做。我找到了一些类似的解决方案,但该解决方案对我不起作用: public void openFolder(View view) { Intent intent = new Intent(Intent.ACTION_GET_CONTENT); Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()

我需要显示SD卡上特定文件夹中的图像。 我想用一个按钮来显示图库。但是,我不知道怎么做。我找到了一些类似的解决方案,但该解决方案对我不起作用:

public void openFolder(View view)
{
    Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
    Uri uri = Uri.parse(Environment.getExternalStorageDirectory().getPath()
            +"/pictures/miscursos/");
    intent.setDataAndType(uri, "image/jpeg");
    startActivity(Intent.createChooser(intent, "Open folder"));
}

这只会打开所有图像,但不会打开我想要的文件夹。

以上代码只会打开文件夹。您必须使用
GallerView
GridView
借助
Adapter
您可以将图像设置为
ListView
GridView
。您必须提供正确的路径才能打开所需的文件夹。