MediaStore查询工作在大多数手机上,而不是EVO [英] MediaStore query works on most phones, but not EVO

查看:99
本文介绍了MediaStore查询工作在大多数手机上,而不是EVO的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有查询MediaStore,并显示在画廊的所有图像的应用程序。简单。它运作良好,对我的Nexus S,Droid X的,和仿真器的各种口味。它给我的朋友埃沃(2.2),但是错误的结果。他只看到两个图像(满分100分在他的画廊)。这里是code:

I have an app that queries the MediaStore and shows all the images in the gallery. Simple. It works well on my Nexus S, Droid X, and all flavors of the emulator. It gives wrong results on my Friends Evo (2.2) however. He sees only two images (out of 100 in his gallery). Here is the code:

    // Where images are stored
    Uri uri = MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI;

    // The columns we want
    String[] projection = { MediaStore.Images.ImageColumns._ID, MediaStore.Images.Thumbnails.IMAGE_ID, MediaStore.Images.Thumbnails.KIND };

    // Select only mini's
    String selection = MediaStore.Images.Thumbnails.KIND + "=" + MediaStore.Images.Thumbnails.MINI_KIND;

    mCursor = this.managedQuery(uri, projection, selection, null, null);
    mCursor.moveToFirst();
    return mCursor;

相当简单和普遍。这里是ImageAdapter:

 View vi=convertView;
 ViewHolder holder;
 if(convertView==null){
        vi = inflater.inflate(R.layout.image_item, null);
        holder=new ViewHolder();
        holder.text=(TextView)vi.findViewById(R.id.text);;
        holder.image=(ImageView)vi.findViewById(R.id.image);
        vi.setTag(holder);
    }
    else {
        holder=(ViewHolder)vi.getTag();
    }
mCursor.requery();
mCursor.moveToPosition(position);

// Build the URI
int id = mCursor.getInt(mCursor.getColumnIndexOrThrow(MediaStore.Images.ImageColumns._ID));
Uri uri = Uri.withAppendedPath(MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, "" + id);
    holder.image.setTag(uri);
    holder.image.setImageURI(uri);

..再次,简单。这是code我从几十个例子,基本上都一样拼凑起来。是什么样的EVO可能导致此不工作。

..again, straightforward. This is code I have cobbled together from dozens of examples, all basically the same. What is it about the EVO that could cause this not to work.

如果我删除查询限制:

// Select only mini's
String selection = MediaStore.Images.Thumbnails.KIND + "=" + MediaStore.Images.Thumbnails.MINI_KIND;

...然后返回近一倍的图像以外还有画廊,但大多数不具备的缩略图。

...then it returns almost double the "images" than there are in the Gallery, but most do not have Thumbnail images.

任何想法?

推荐答案

根据文档的SenseUI手机不都这样做的缩略图。他们中有些人只做MICRO_KIND缩略图 - 我记住了令人难以置信的做同样的事情。为了获取图像应用程序,我曾经工作在正常工作,我只好查询两种缩略图,甚至有时会推出自己的。

The SenseUI phones don't all do thumbnails according to the documentation. Some of them only do MICRO_KIND thumbnails - I remember the Incredible doing the same thing. In order to get the image app that I used to work on to work correctly, I had to query both kinds of thumbnails and even sometimes roll my own.

这篇关于MediaStore查询工作在大多数手机上,而不是EVO的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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