android - Download images in async task and show them in ListView -
i've list of urls, each corresponding image.
i need display these images in listview
.
currently, approach pass list<string>
containing urls customadapter (extending baseadapater)
.
each row item in listview inflated imageview
.
then in getview()
method, if currentimageview == null
, i'll start asynctask
, download bitmap imagelist.get(position)
.
then in postexecute()
, i'll set currentimageview.setbitmap(downloadedbitmap)
.
in manner,from inside adapter, i'll call asynctask one-by-one each image.
if think, there wrong in approach please let me know. also, please suggest correct approach.
one pitfall approach i've found in when asynctask list element in progress & user scrolls down up, same async task called again.
how can prevent this?
when views recycled, currentimageview not null , keep displaying same images. suggest using universal image loader. takes care of of you, tons of features caching , not.
Comments
Post a Comment