android从图库中检索图像resolveUri在错误的位图uri警告上失败

时间:2014-01-21 10:15:49

标签: android cursor android-gallery

其实我正在从图库中检索图像,这样一些图像没有在listview中显示我收到了这个警告,我需要提一下图像的mime类型,请帮助我。

警告

01-21 15:34:13.880: I/System.out(25658): resolveUri failed on bad bitmap uri: content://media/external/images/thumbnails/105
01-21 15:34:13.905: W/ImageView(25658): Unable to open content: content://media/external/images/thumbnails/104
01-21 15:34:13.905: W/ImageView(25658): java.io.FileNotFoundException: No entry for content://media/external/images/thumbnails/104
01-21 15:34:13.905: W/ImageView(25658):     at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:146)
01-21 15:34:13.905: W/ImageView(25658):     at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:646)
01-21 15:34:13.905: W/ImageView(25658):     at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:768)
01-21 15:34:13.905: W/ImageView(25658):     at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:665)
01-21 15:34:13.905: W/ImageView(25658):     at android.content.ContentResolver.openInputStream(ContentResolver.java:500)
01-21 15:34:13.905: W/ImageView(25658):     at android.widget.ImageView.resolveUri(ImageView.java:672)
01-21 15:34:13.905: W/ImageView(25658):     at android.widget.ImageView.setImageURI(ImageView.java:407)
01-21 15:34:13.905: W/ImageView(25658):     at com.example.imageloder.CustomAdapter.bindView(CustomAdapter.java:42)
01-21 15:34:13.905: W/ImageView(25658):     at android.support.v4.widget.CursorAdapter.getView(CursorAdapter.java:256)
01-21 15:34:13.905: W/ImageView(25658):     at android.widget.AbsListView.obtainView(AbsListView.java:2608)
01-21 15:34:13.905: W/ImageView(25658):     at android.widget.ListView.makeAndAddView(ListView.java:1852)
01-21 15:34:13.905: W/ImageView(25658):     at android.widget.ListView.fillDown(ListView.java:682)
01-21 15:34:13.905: W/ImageView(25658):     at android.widget.ListView.fillGap(ListView.java:646)
01-21 15:34:13.905: W/ImageView(25658):     at android.widget.AbsListView.trackMotionScroll(AbsListView.java:6592)

代码:

imageCursor = getContentResolver().query(
                    MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI, null, null, null,
                    null);

            if (imageCursor != null) {
                imageCursor.moveToFirst();
                if (imageCursor.getCount() > 0) {

                    do {

            String imagename = imageCursor
                                .getString(imageCursor.getColumnIndex(MediaStore.Images.Thumbnails._ID));
             int imageID = imageCursor.getInt(imageCursor.getColumnIndex(MediaStore.Images.Thumbnails.IMAGE_ID)); 
                                            mdatabaseHelper.insertImageDetails(imagename,imageID);
                    } while (imageCursor.moveToNext());
                }
            } else {
                System.out.println("^^=================" + "cursor value"
                        + imageCursor.getCount());
            }

0 个答案:

没有答案