android - How can i recycle imageView by using imagepath -
here storing image paths database. in tabhost
, if click find tab images should displayed. @ time outofmemoryerror
coming. please me. important me.
image s = pictures.get(i); tablerow imagetablerow = new tablerow(ctx); imagetablerow.setlayoutparams(new tablelayout.layoutparams(layoutparams.fill_parent,layoutparams.wrap_content)); imageview imageview = new imageview(ctx); log.i("neverforget","picture image path : " + s.getimagepath()); drawable d = drawable.createfrompath(s.getimagepath()); imageview.setimagedrawable(d); imageview.setid(i); imageview.setlayoutparams(new tablerow.layoutparams(100,100)); imageview.setpadding(0, 10, 0, 15);
don't use drawable.createfrompath()
bound load images @ native resolution. doubtless these large images, photos etc, , therefore require vast amounts of memory once decompressed, , hence oom errors. if you're asking them render small box, fully-sized in memory.
you should instead use bitmapfactory.decodefile()
in conjunction suitable choice bitmapfactory.options.insamplesize
.
Comments
Post a Comment