android - Out of memory error when nesting gridview inside listview -


i'm trying add gridview of images (imageview) android application. i've implemented lazy loading , caching of images , of high quality images work flawlessly when have simple gridview. however, problem occurs when try nest gridview inside listview.

when have gridview, app has keep reference images being rendered on screen. when nest gridview of, 100 hi-res images, inside listview, app tries keep reference 100 images, when 20 of them being rendered on screen @ time. found out through log output, app print message every time image "read". see app read 20 images being displayed on screen, keep going , read more images. when reaches around 100~ images, app run out of memory , crash. behavior not happen when have gridview; app read 20 images, , load more scroll screen.

how can make listview not try load elements inside child view (especially 1 that's not being displayed on screen)?

thanks!

edit: wondering why want gridview inside listview, it's because i'm trying create this: nested gridview

except i'd have in listview, opposed expandablelistview.

you getting exception because in expanded gridview data loaded in memory, if data cause outofmemory exception.
the solution is: divide data in small parts , try.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -