i have imageadapter code :
import android.content.context; import android.net.uri; import android.util.log; import android.view.view; import android.view.viewgroup; import android.widget.baseadapter; import android.widget.gridview; import android.widget.imageview; public class imagegalleryadapter extends baseadapter { private context mcontext; public string[] imagepaths; public imagegalleryadapter(context c, string paths) { mcontext = c; imagepaths = paths.split(";"); } @override public int getcount() { return imagepaths.length; } @override public object getitem(int position) { // todo auto-generated method stub return imagepaths[position]; } @override public long getitemid(int position) { // todo auto-generated method stub return 0; } @override public view getview(int position, view convertview, viewgroup parent) { log.i("image gallery adapter", ""+position); imageview imageview = new imageview(mcontext); imageview.setimageuri(uri.parse(imagepaths[position])); imageview.setscaletype(imageview.scaletype.center_crop); imageview.setlayoutparams(new gridview.layoutparams(70, 70)); return imageview; } }
i dont know why, make apps not responding, try set log.i check position in getview, , result position have value = 0, whereas imagepath.length = 4.
why stuck in position = 0
this log :
07-11 18:38:25.310: i/image gallery adapter(32154): **0** 07-11 18:38:25.313: i/mdpservice(32154): [mdp info](32154): bpmdpservice::parsejpg addr:0x53c64000, size:65536, fd:59 07-11 18:38:25.316: i/mdpservice(32154): [mdp info](32154): bpmdpservice::parsejpg reply:6 07-11 18:38:25.316: w/skia(32154): use jpeg sw decoder 07-11 18:38:25.484: i/dalvikvm-heap(32154): grow heap (frag case) 29.849mb 19660816-byte allocation 07-11 18:38:25.726: i/surfacetextureclient(32154): [void android::surfacetextureclient::init()] debug.stc.fps: 3000 ms 07-11 18:38:25.744: e/mmumapper(32154): fail register mva, unsupported format(0x5) 07-11 18:38:25.746: i/image gallery adapter(32154): **0** 07-11 18:38:25.749: i/mdpservice(32154): [mdp info](32154): bpmdpservice::parsejpg addr:0x53c64000, size:65536, fd:60 07-11 18:38:25.751: i/mdpservice(32154): [mdp info](32154): bpmdpservice::parsejpg reply:6 07-11 18:38:25.751: w/skia(32154): use jpeg sw decoder 07-11 18:38:25.943: i/dalvikvm-heap(32154): grow heap (frag case) 48.574mb 19660816-byte allocation 07-11 18:38:26.191: i/image gallery adapter(32154): **0** 07-11 18:38:26.194: i/mdpservice(32154): [mdp info](32154): bpmdpservice::parsejpg addr:0x53c64000, size:65536, fd:60 07-11 18:38:26.195: i/mdpservice(32154): [mdp info](32154): bpmdpservice::parsejpg reply:6 07-11 18:38:26.195: w/skia(32154): use jpeg sw decoder 07-11 18:38:26.214: i/dalvikvm-heap(32154): forcing collection of softreferences 19660816-byte allocation 07-11 18:38:26.243: e/dalvikvm-heap(32154): out of memory on 19660816-byte allocation.
please solve this
it seems though bitmaps causing out of memory exeption , not being added, try re-sampling images smaller
out of memory on 19660816-byte allocation.
are adding item string array?
Comments
Post a Comment