android:如何将图像添加到相册 [英] android: how to add an image to an album

查看:122
本文介绍了android:如何将图像添加到相册的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以共享代码(或将我指向Android示例代码)来帮助我将图像添加到媒体商店(画廊)中的相册.

Can anyone share code (or point me to Android sample code) to help me add images to an album in the Media Store (Gallery).

在我的应用程序中,我从服务器下载图像,并使用相机(通过Intent)拍摄新图像.

In my app I download images from our server, and also take new images using the camera (via Intent).

我想将这些图像整理到一个特定于应用程序的相册中,类似于Facebook(和其他应用程序)应用程序所做的那样,使所有相关图像保持整齐.

I would like to organize those images in an app-specific album, similar to what the Facebook (and other apps) app does, keeping related images all neatly organized.

前一段时间,我遵循Media Store API文档进行了调查,但是它对我不起作用....因此需要一些帮助.

I looked into this a while ago, following the Media Store API docs, and it didn't work for me....so need some help.

谢谢

推荐答案

您可以使用:

  MediaStore.Images.Media.insertImage(ContentResolver cr, Bitmap source, String title, String description);

并且我确定在此处 http://developer.android.com/guide/在某些子菜单中显示了一个命令,要求MediaStore扫描确定的文件夹,我现在找不到它.

and I'm sure that somewhere here http://developer.android.com/guide/ in some of the sub-menus shows a command asking the MediaStore to scan a determined folder, I just can't find it now.

修改: 找到了:

 MediaScannerConnection.scanFile(Context context, String[] path, null, null);

这篇关于android:如何将图像添加到相册的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆