取从Android的照片库的所有图片 [英] Fetch all Images from Android Photo Gallery

查看:101
本文介绍了取从Android的照片库的所有图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想获取来自Android的照片库我的应用程序的所有图像。因为我想将它保存到Android的画廊后,图像加载到我的应用程序了。 救了我的形象进入画廊我使用下面的方法。

I want to fetch all images in my application from android photo gallery .because I want to load an image into my application again after saving it into android gallery . For Saving my image into gallery I use below method.

MediaStore.Images.Media.insertImage(ContentResolverObj, bitMap, "uniqueTitle", "description"); 

现在编程我想所有图像抓取到我的应用程序,并希望得到上面保存的图像tile.Two问题的基础上,在这里。 第一:我可以去从Android的照片库的所有图像? 第二:我可以读取后读取一张照片的细节如标题等

Now programatically I want to fetch all images into my application and want to get above saved image on the basis of tile.Two questions here. 1st:Can I fetch all images from photo gallery of android ? 2nd:can I read single photo detail like title etc after fetching it.

推荐答案

我用低于code,得到的图像,可能是这对你的工作

I used below code and got image, may be it's work for you

final String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID };
    final String orderBy = MediaStore.Images.Media._ID;
    imagecursor = getActivity().managedQuery(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null, null, orderBy);
    int image_column_index = imagecursor.getColumnIndex(MediaStore.Images.Media._ID);
    this.count = imagecursor.getCount();
    this.arrPath = new String[this.count];
    ids = new int[count];
    for (int i = 0; i < this.count; i++) {
        imagecursor.moveToPosition(i);
        ids[i] = imagecursor.getInt(image_column_index);
        int dataColumnIndex = imagecursor.getColumnIndex(MediaStore.Images.Media.DATA);
        arrPath[i] = imagecursor.getString(dataColumnIndex);
    }

您可以找到适配器code GridView和setadapter从下面的网址 源$ C ​​$下适配器和gridviw

you can find adapter code gridview and setadapter from below URL source code for adapter and gridviw

这篇关于取从Android的照片库的所有图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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