I have a class that extends ListFragment, and it overrides the OnListItemClick method. I am also doing this in another ListFragment the same way (and the method gets called)
Only workaround so far, use a Fragment and a ListView then use setOnItemClickListener() which would make the ListFragment, and all its' convenience obsolete...
After I created a new class containing exactly the same code (only the class name changed) and built the project on a different machine it "magically" worked (Still same API-Level). Below the code that worked. I also tried project->clean which usually fixes most problems, but that did not work eiter.
public class ContainerFragment extends ListFragment {
private ContainerFragmentListener listener;
public ContainerFragment(ContainerFragmentListener listener) {
super();
this.listener = listener;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
setListAdapter(new ContainerAdapter(getActivity()));
}
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
super.onListItemClick(l, v, position, id);
Container container = (Container) getListAdapter().getItem(position);
listener.containerSelected(container.id);
}
}