Why is my onItemSelectedListener not called in a ListView?

Posted by Janusz on Stack Overflow See other posts from Stack Overflow or by Janusz
Published on 2010-03-16T12:41:28Z Indexed on 2010/03/16 12:46 UTC
Read the original article Hit count: 599

Filed under:
|
|

I'm using a ListView that is setup like this:

<ListView android:id="@android:id/list" android:layout_width="fill_parent"
    android:layout_height="fill_parent" android:longClickable="false"
    android:choiceMode="singleChoice">
</ListView>

In my code I add an OnItemSelectedListener to the ListView like this:

getListView().setAdapter(adapter);
getListView().setOnItemSelectedListener(this);

my Activity implements the listener like this:

@Override
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
    Log.d("LocateByCategory", "ListItemSelected: Parent: " + parent.toString() + " View: "
            + view.toString() + " Position: " + " Id: " + id);
}

My hope was, that I would see this debug output the moment I click on something in the list. But the debug output is never shown in LogCat.

© Stack Overflow or respective owner

Related posts about android

Related posts about listview