Re: [android-developers] Android = 1.6: Invalid View object passed to onListItemClick()?

2009-12-15 Thread Eus
HiHo! On Mon, 2009-12-14 at 11:06 -0800, Romain Guy wrote: v.setBackgroundResource(R.color.todo_item_highlighted); Here's your problem. Views are reused by ListView (so if you change the background of item #1, it might be reused as item #4 later), You mean the reuse of

Re: [android-developers] Android = 1.6: Invalid View object passed to onListItemClick()?

2009-12-15 Thread Romain Guy
Why is this not documented in the documentation of onListItemClick() giving a warning that v may not be as what the developer expects? Because v is always what you expect. The problem is what happens to v after the click. You mean something like the following? [...] Yes, except that when pos

[android-developers] Android = 1.6: Invalid View object passed to onListItemClick()?

2009-12-14 Thread Eus
HiHo! This subject originates here: http://groups.google.com/group/android-beginners/browse_thread/thread/772ff8b97facfab2/9a470dd0b71dbef3 To sum up: When I click on an item in the ListView, the background color that gets changed is not that of the clicked item but instead of the other item in

Re: [android-developers] Android = 1.6: Invalid View object passed to onListItemClick()?

2009-12-14 Thread Romain Guy
Hi, It looks like you are doing the wrong thing in your adapter. Are you locally caching views yourself? On Mon, Dec 14, 2009 at 12:49 AM, Eus reply.to.eus.at.member.fsf@gmail.com wrote: HiHo! This subject originates here:

Re: [android-developers] Android = 1.6: Invalid View object passed to onListItemClick()?

2009-12-14 Thread Eus
HiHo! On Mon, 2009-12-14 at 09:18 -0800, Romain Guy wrote: Hi, It looks like you are doing the wrong thing in your adapter. Are you locally caching views yourself? AFAIK, no, I am not. I just do very simple stuff using the available APIs without touching fancy stuff like caching. The

Re: [android-developers] Android = 1.6: Invalid View object passed to onListItemClick()?

2009-12-14 Thread Romain Guy
           v.setBackgroundResource(R.color.todo_item_highlighted); Here's your problem. Views are reused by ListView (so if you change the background of item #1, it might be reused as item #4 later), this type of change must be done from the Adapter's getView() method. -- Romain Guy Android