android - Error in gallery activity imageLoader -
i keep getting these errors force closing activity. runs on regular devices on tablet these errors?
07-21 19:34:45.472: error/androidruntime(409): @ android.os.strictmode$androidblockguardpolicy.onnetwork(strictmode.java:1077)
07-21 19:34:45.472: error/androidruntime(409): @ java.net.inetaddress.lookuphostbyname(inetaddress.java:477) 07-21 19:34:45.472: error/androidruntime(409): @ android.widget.relativelayout.measurechildhorizontal(relativelayout.java:581) 07-21 19:34:45.472: error/androidruntime(409): @ com.you.mainmenu$imageadapter.getview(mainmenu.java:242) 07-21 19:34:45.472: error/androidruntime(409): @ android.view.view.measure(view.java:10828) 07-21 19:34:45.472: error/androidruntime(409): @ android.view.viewgroup.measurechildwithmargins(viewgroup.java:4351)
its pointing me here:
} @override protected void onpostexecute(void notused){ ((gallery) findviewbyid(r.id.gallery)) .setadapter(new imageadapter(mainmenu.this)); }
when commented out, worked fine.
here code of imageloader
public view getview(int position, view convertview, viewgroup parent) { imageview = new imageview(this.mycontext); try { /* open new url , inputstream load data it. */ url aurl = new url(myremoteimages[position]); urlconnection conn = aurl.openconnection(); conn.connect(); inputstream = conn.getinputstream(); /* buffered performance plus. */ bufferedinputstream bis = new bufferedinputstream(is); /* decode url-data bitmap. */ bitmap bm = bitmapfactory.decodestream(bis); bis.close(); is.close(); log.v(imageurl, "retrieving image"); /* apply bitmap imageview returned. */ i.setimagebitmap(bm); } catch (ioexception e) { log.e("debugtag", "remtoe image exception", e); } /* image should scaled width/height set. */ i.setscaletype(imageview.scaletype.fit_center); /* set width/height of imageview. */ i.setlayoutparams(new gallery.layoutparams(150, 150)); return i; }
seems stuck bug. testing on honeycomb?
https://github.com/mopub/mopub-client/issues/2
honeycomb doesn't seem allow network access on main thread. refer thread android honeycomb: networkonmainthreadexception when using asynctask , no strict mode?
Comments
Post a Comment