how to avoid memory leaks in android -


i dynamically updating tablelayout shown below appending imagebutton , textview each tablerow.whenever launch activity shows 4 rows (should display 10 actually) if keep break points in code , debug figure out problem displays 10 rows properly. doubt must memory problem in code getting images web feel takes lot of memory. tried releasing views memory after adding layout crashing time.
please let me know doing wrong.

for (int = 0; < parsedexampledataset.getappnamestring().size(); i++)   {    tablerow row = new tablerow(this);    textview tv = new textview(this);    tv.settext("appname: "+ parsedexampledataset.getappnamestring().get(i) +"\n"     + "description: " + parsedexampledataset.getdescriptionstring().get(i));    imagebutton imgbtn = new imagebutton(this);    url aurl = new url(parsedexampledataset.getimageurlstring().get(i));     urlconnection conn = aurl.openconnection();     conn.connect();     inputstream = conn.getinputstream();     bufferedinputstream bis = new bufferedinputstream(is);    bitmap bm = bitmapfactory.decodestream(bis);     imgbtn.setimagebitmap(bm);    imgbtn.setbackgroundcolor(color.transparent);    imgbtn.settag(parsedexampledataset.getmarketlinkstring().get(i));    bis.close();     is.close();                        row.addview(imgbtn);    row.addview(tv);    table.addview(row,new tablelayout.layoutparams(layoutparams.wrap_content, layoutparams.wrap_content));  //here table tablelayout object 

}

thanks in advance
prathima

if want load more 1 row use listview.

it handles memory issues , better tablelayout.

here 1 example.


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -