Hi arnouf,
I don't mean to butt in but I suspect this is a similar problem to
something I saw before.

In your ViewAdapter, I am assuming you are creating or using a View
which is or contains an ImageView which you are trying to load the
image contents for remotely. If you are always creating the view in
your adapter, then it simplifies the process a lot but at a
performance tradeoff since you won't get the View recycling that the
ListView does for you. If you create only when the view passed into
your adapter is null, and use the passed in View other times then you
gain some performance, however now you have to sync the ImageViews to
what is being displayed on the screen or else like you said, you may
get images rendered in the incorrect cells of the list.

So there are 2 problems,

#1 For the AsyncTask, you can still use the AsyncTask, but stagger
their execution (try using a handler on the UI thread to spawn the
AsyncTask after a delay, via postDelay).

#2 The Image Syncing problem, when you get the information back you
should make sure the view that the task is loading the image for is
not "dirty." By dirty I mean that the ListView is still displaying
that cell and it is the correct cell. It may have been recycled and
passed back to your adapter as the user scrolled and you will end up
out of sync. I have been storing the image url in the tag of the image
view and on a successful image load comparing the tag with the source
of the image bitmap to make sure the view still is "fresh." If you
cache the image somewhere (in memory or storage) you can then retrieve
it faster later and just fill the image view next time that cell needs
to be rendered.

Not sure if this is the exact problem you describe but I don't see any
harm in giving some advice. Hope it helps.

-Greg

On Apr 7, 8:14 am, arnouf <[email protected]> wrote:
> I'm not sure that it will resolve my first problem related to the
> image loaded from remote and display in my listview
> I can useAsynctaskin my adapter to load each image. But when I do a
> bog scroll, displayed image are not to the good place (ex. : the image
> number 4 is displayed at the line 15 ...). It's trying to tesolve this
> first issue, that I meet the exception. But this issue is maybe due to
> the Async pooltoo.
>
> I come you back later.
>
> Thanks
>
> On Apr 7, 4:37 pm, "Mark Murphy" <[email protected]> wrote:
>
>
>
> > > When you have a lot of Image to load this is a big limitation.
>
> > You can:
>
> > -- Grab the source code toAsyncTask, clone it into your own package, and
> > modify the LinkedBlockingQueue. I did this with my AsyncTaskEx class.
>
> > -- SkipAsyncTaskand roll your own thread pool.
>
> > --
> > Mark Murphy (a Commons Guy)http://commonsware.com
> >AndroidApp Developer Books:http://commonsware.com/books.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

To unsubscribe, reply using "remove me" as the subject.

Reply via email to