[英]Android - How to open a specific folder in a gallery using an implicit intent?
[英]How to open gallery in specified folder using intent
您能帮我如何使用intent打开指定文件夹中的图片库吗? 只能从指定的文件夹中打开图库(如下图所示)。
但是,它不返回任何值或活动。
我尝试了很多方法,但是都没有打开指定的Gallery文件夹
我试过了
Intent intent = new Intent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_VIEW);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
这有效,但仅打开图库,不在指定文件夹中
另一个
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"));
这将打开最近的文件,但不仅是查看图库,它还会选择一个文件并返回。
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);
并且只显示白屏。 是否可以在指定的文件夹中打开图库? 如果可能,它将像这样打开:
是否可以在指定的文件夹中打开图库?
不,对不起
画廊的选择并非旨在从这样的任何位置打开。 支持的位置:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.