android - Out of memory issue Bitmap -
getting out of memory issue
final string[] columns = { mediastore.images.media.data, mediastore.images.media._id }; final string orderby = mediastore.images.media._id; cursor imagecursor = managedquery( mediastore.images.media.external_content_uri, columns, null, null, orderby); int image_column_index = imagecursor.getcolumnindex(mediastore.images.media._id); count = imagecursor.getcount(); thumbnails = new bitmap[count]; arrpath = new string[count]; thumbnailsselection = new boolean[count]; (int = 0; < count; i++) { imagecursor.movetoposition(i); int id = imagecursor.getint(image_column_index); int datacolumnindex = imagecursor.getcolumnindex(mediastore.images.media.data); thumbnails[i] = mediastore.images.thumbnails.getthumbnail( getapplicationcontext().getcontentresolver(), id, mediastore.images.thumbnails.micro_kind, null); arrpath[i]= imagecursor.getstring(datacolumnindex); } gridview imagegrid = (gridview) findviewbyid(r.id.phoneimagegrid); imageadapter = new imageadapter(); imagegrid.setadapter(imageadapter); imagecursor.close();
getting out of memory error here on bitmap:
bitmap thumbnails[i] = mediastore.images.thumbnails.getthumbnail( getapplicationcontext().getcontentresolver(), id, mediastore.images.thumbnails.micro_kind, null);
it crashing in devices please help
if @ android training manuals, there few documents telling how this: http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html
personally, use android universal image loader take care of you.
Comments
Post a Comment