简体   繁体   English

如何使用Intent打开指定文件夹中的库

[英]How to open gallery in specified folder using intent

Can you help me how to open gallery in specified folder using intent? 您能帮我如何使用intent打开指定文件夹中的图片库吗? It only opening gallery from specified folder like this (screenshot below). 只能从指定的文件夹中打开图库(如下图所示)。

However, it is not returning any value or activity. 但是,它不返回任何值或活动。

I've try a lot of methods, but none open the specified gallery folder 我尝试了很多方法,但是都没有打开指定的Gallery文件夹

I tried 我试过了

Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

This works, but only opening gallery, not in specified folder 这有效,但仅打开图库,不在指定文件夹中

another one 另一个

Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath() + "/CameraExample/");
intent.setDataAndType(uri, "*/*");
startActivity(Intent.createChooser(intent, "Open folder"));

this will open recent file, but it's not just viewing gallery, it choose a file, and return it. 这将打开最近的文件,但不仅是查看图库,它还会选择一个文件并返回。

Intent intent = new Intent();
Uri uri = Uri.parse(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).getPath() + "/CameraExample/");
intent.setDataAndType(uri, "*/*");
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);

and it only shows a whitescreen. 并且只显示白屏。 Is it possible to open gallery in specified folder? 是否可以在指定的文件夹中打开图库? It would open like this if possible: 如果可能,它将像这样打开:

屏幕截图-在文件夹中打开图库

is it possible to open gallery in specified folder? 是否可以在指定的文件夹中打开图库?

No, sorry. 不,对不起

The gallery selection was not designed to be opened from any location like that. 画廊的选择并非旨在从这样的任何位置打开。 Supported locations: 支持的位置:

  1. Album location( /sdcard/dcim) 相册位置(/ sdcard / dcim)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM