I am testing my app in the new Android system 4.1 Jelly Bean, and my ListFragment is not working properly anymore.
When I click on a list’s row, the function onListItemClick is not call anymore. It use to work juste fine on Android 3.0 and Android 2.x
Does anything change into Android 4.x concerning the ListFragment or the onListItemClick ?
One precision, I am using ‘ListFragment’ from the android-support-v4.jar
android.support.v4.app.ListFragment
Here is my ListFrangment code :
public class MessagesListFragment extends ListFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.pull_to_refresh, null);
return view;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
/* some initialization, working fine */
/* Settings of the list Adapter*/
@Override
public void onListItemClick(ListView l, View v, int position, long id) {
int messagePosition = 0;
if(position>0){
messagePosition = position - 1;
} else {
Log.e("MessageListView", "[onListItemClick] position is inferior to zero,"
+ " message position is set to 0");
}
String expediteur = DomboxHome.messagesService.messagesArrayList.get(messagePosition).getExpediteur();
String contenu = DomboxHome.messagesService.messagesArrayList.get(messagePosition).getContenu();
Log.d("MessageListView","[onListItemClick] click on message position : "+messagePosition);
((MessagesActivity)getActivity()).onChooseMessageDetails(expediteur, contenu);
}
I found the solution,
The blame was not on android-support-v4.jar but on android-pulltorefresh with is a library to implement pull-to-refresh-list.
Android pull to refresh list
The library was not fully compatible with Jelly Bean, but it is already fixed by the team (by the way, thank you to the team ! )
Bug fixed