Android 从文件夹中打开图库

标签 android android-intent android-image android-gallery

我想在 android 图库中显示一张照片,并能够滑动将其他照片扔到该文件夹​​中。

Intent intent = new Intent(Intent.ACTION_VIEW);
File f = new File(path);
intent.setDataAndType(Uri.parse("file://" + f.getAbsolutePath()), "image/*");
mContext.startActivity(intent);

这就是我现在的做法,但不会让我滑动文件夹中的其余图像。 我试过:

How to open one particular folder from gallery in android?

Built-in gallery in specific folder

Gallery with folder filter

没有任何运气。 如果有人有解决方案,我会很高兴。 谢谢!

最佳答案

试试这个

Intent i=new Intent();
i.setAction(Intent.ACTION_VIEW);
i.setDataAndType(Uri.fromFile(new File(path)), "image/*");  
startActivity(i);

查看这些链接

How can I use Intent.ACTION_VIEW to view the contents of a folder?

Android ACTION_VIEW Multiple Images

Java and Android: How to open several files with an Intent?

如果这能解决您的问题。也检查一下

https://www.google.co.in/?gfe_rd=cr&ei=c5n9U6ruE7DO8gfXz4G4BA&gws_rd=ssl#q=view+like+gallery

同时检查 Gallery 小部件

关于Android 从文件夹中打开图库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25478828/

相关文章:

java - 在 android-j2se 上使用 SSL 与服务器客户端套接字通信

android - Android 在具有相同操作和类别的多个组件之间有何不同?

Android 日历时区不随 CalendarContract 改变

android - 如何将图像转换为 PDF?

android - 在将中心点保持在同一位置的同时缩放 ImageView 的图像

android - viewModelScope 默认为 MainThread 的原因是什么?

android - 可以删除 build.gradle (app) 上的一些行

android - 如何在 ExoPlayer 中显示图像?

android - 如何使用 Android Intent 调用字典应用程序

android - 如何在android中对图像进行加密和解密?