Btw each listview element is bound to two textviews. So I won't be
able to cast the view of the selected item as a textview.

Do you know of a good way to get the text of the selected listview
element (when someone presses a menu option or button)

On Apr 13, 6:16 pm, Ram <[EMAIL PROTECTED]> wrote:
> Thanks snowdrifter, I need capture the text of the selected listview
> entry (when someone presses a menu option or a button)
>
> Incidentally the notepad tutorial does an extra query to get the db
> value from the selected _id.
> However, this seems like a wasteful operation (since the value is
> already available in the selected listview element) and I'm hoping
> that there is an easy to get the text of the selected listview entry.
>
> On Apr 13, 5:55 pm, SnowDrifter <[EMAIL PROTECTED]> wrote:
>
>
>
> > If you are using onListItemClick it will give you the ListView for
> > that selected item which you can access as a view if you cast it to
> > whatever view you are using or use the id passed to index into your
> > cursor and get the data out.
>
> > TextView text = (TextView)(l.getChildAt(position));
>
> > On Apr 13, 4:58 pm, Ram <[EMAIL PROTECTED]> wrote:
>
> > > Hi, I'm using a simplecursoradapter to map a db cursor to a listview
>
> > > The listview displays "n" rows for "n" rows in the cursor.
>
> > > When the user selects a listview entry, I can use
> > > listview.getSelectedItemId() to get the "_id" value of the selected
> > > entry.
>
> > > However, I couldn't find an api to get the text of the selected
> > > listview element.
> > > This seems like a fairly easy thing to do, but I'm not sure what I'm
> > > overlooking here.
>
> > > Does anyone know how to get the text displayed by the selected
> > > listview item.- Hide quoted text -
>
> > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to