Click Listener not invoked within ListFragment
- by membersound
I'm extending a SherlockListFragment, but it should not matter as my question seems to be more general related to Fragments.
Now, I implement a simple click listener for my list, but it does not get called.
public class MyListFragment extends SherlockListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View v = inflater.inflate(R.layout.list, container, false);
v.setOnClickListener(new OnClickListener() {
public void onClick(View view) {
Log.i("debug", "single click");
}
});
return v;
}
}
Is anything wrong with this?
//Solution:
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Log.i("debug", "single click");
}
});