On Nov 11, 7:39 am, Elison Lusvardi <[email protected]> wrote:
> Hi guys, how are you?
>
> I have a problem in my application's ListView.
> Each item in the ListView can be created by different widgets, some have
> pictures, the layout is different in each case, some have images, others
> have buttons, etc..
>
> All of them have actions like onClick and onLongClick - being in the widget
> itself or in a button.
>
> The cost to create each element is high, and the performance is a little
> bit low. So, I decided to store these items in a HashMap <Key, MyWidget>
> and whenever you create a new item, make sure if it is already inserted in
> my "cache" verifying by a Key
> So far so good, it works in order to get these items and recycles them,
> except that when I perform some action, it usually does not work.
>
> The itens doesn't longer detects the onClick, the onLongClick until it goes
> to outside the viewing area of the ListView. For example. I tap on the
> picture to open it and nothing happens. But when I take a scroll up or
> down, when that picture out of my sight, the app displays the picture with
> the viewer. If I hit a 3 or 4 times, when I move the scroll, the viewer
> will be opened 3 or 4 times .. = /
>
> Does anyone have any idea why this happens?
>
> thanks!
>
> --
> Elison José Gracite Lusvardi

Can you explain how you use your HashMap in relation to the list? I'm
guessing you're referencing it in a getView(...) method of a list
adapter. If so, could the problem be incompatible Views between what's
being passed to getView(...) as the convertView parameter and what
it's being populated with from the cache? Just a swag...

- Dave

-- 
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

Reply via email to