1

I have an auto-complete drop down list, I want to make some action when I click on one item in the list.. is there any listener or event handler to to this ??

Adham
  • 63,550
  • 98
  • 229
  • 344

2 Answers2

1

use this, this will provide you method called setOnItemClickListener().

Harry Joy
  • 58,650
  • 30
  • 162
  • 207
  • how can i get the string text of the selected item ?? ,, where i need to implement this method public void onItemSelected(AdapterView> parent, View view, int position, long id){ view. } right ?? – Adham Jan 08 '11 at 10:02
  • Make a class which implements AdapterView.OnItemSelectedListener and in that method called getItemAtPosition(position) will help you to get the data. see http://developer.android.com/reference/android/widget/AdapterView.OnItemSelectedListener.html – Harry Joy Jan 08 '11 at 10:16
0
private AdapterView.OnItemClickListener searchItemClicked = new AdapterView.OnItemClickListener()
{
    public void onItemClick(AdapterView<?> parent, View view, int position, long id)
    {
    //your code here
    }
}

It's important to note that OnItemSelectedListener does not activate when a user selects a dropdown.

Steven
  • 3,200
  • 1
  • 17
  • 16