You can also get the Cursor to the selected item by using

Cursor c = (Cursor)parent.getItemAtPosition(position);

and simply get the name by using

String name = c.getString(nameColumIndex);

On Jan 15, 11:22 pm, Andrew Stadler <stad...@gmail.com> wrote:
> Don-
>
> Here is one way to do this:
>
> In your activity declaration, add this interface:
>
>    MyActivity extends Activity implements OnItemClickListener
>
> Then implement as follows:
>     /**
>      * Implements OnItemClickListener
>      */
>     public void onItemClick(AdapterView<?> parent, View view, int
> position, long id) {
>         if (parent == myAutoCompleteTextView) {
>            // handle item click
>         }
>     }
>
> For additional tricks, see also  OnItemSelectedListener.
>
> Hope this helps.
> --Andy
>
>
>
> On Thu, Jan 15, 2009 at 5:45 AM, Don Rules <don.rulz.wo...@gmail.com> wrote:
> > I have written an application to show the contacts in the
> > AutoCompleteTextView.
> > while the user types the alphabets, it fetches the matching contacts to
> > display.
>
> > For this I have used a CursorAdapter
>
> > Now I have to get the Contact name when the contact is clicked.
>
> > How do i use setOnItemSelectedListener(AdapterView.OnItemSelectedListener l)
> > for the AutoCompleteTextvView.
>
> > Please help.
>
> > Regards,
> > Don.

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

Reply via email to