20 messages in com.googlegroups.android-beginners[android-beginners] Re: getting item ...
FromSent OnAttachments
Sylvester Steele21 Jun 2008 07:22 
Mark Murphy21 Jun 2008 09:23 
Sylvester Steele21 Jun 2008 20:48 
Sylvester Steele21 Jun 2008 20:56 
Mark Murphy22 Jun 2008 05:00 
Sylvester Steele22 Jun 2008 23:09 
Sylvester Steele26 Jun 2008 02:23 
Romain Guy26 Jun 2008 02:31 
Sylvester Steele26 Jun 2008 08:51 
Romain Guy26 Jun 2008 08:59 
Fräntz Miccoli26 Jun 2008 09:00 
Sylvester Steele26 Jun 2008 23:06 
Romain Guy26 Jun 2008 23:34 
Sylvester Steele27 Jun 2008 11:10 
Romain Guy27 Jun 2008 11:18 
jan....@gmail.com27 Jun 2008 11:19 
Mark Murphy27 Jun 2008 11:33 
Romain Guy27 Jun 2008 11:46 
Mark Murphy27 Jun 2008 11:52 
Sylvester Steele29 Jun 2008 02:55 
Subject:[android-beginners] Re: getting item name from listview.
From:Romain Guy (roma@google.com)
Date:06/26/2008 11:34:54 PM
List:com.googlegroups.android-beginners

getChildAt(position) won't work if you scroll the list. You are just trying to retrieve the data in an unusual way. Like we said before, you should talk to the Adapter, not to ListView to get the data. You could also call obtainItem(int position) on the ListView, which is similar to calling adapter.getItem(int position). However, *in your case*, you will get back a Cursor and there's no way we will know what you want out of this cursor. It's up to you to get the right data out of the cursor.

On Thu, Jun 26, 2008 at 11:07 PM, Sylvester Steele <sylv@gmail.com> wrote:

phew!

finally, (TextView)fruitsList.getChildAt(position)).getText() worked.

But why are all these typecasting acrobatics necessary? I mean why isn't there a simple method that does this?

Or is what I am asking too unusual?

Thanks Mark and thanks Romain.

Sylvester