我正在新的Android 系统 4.1 Jelly Bean中测试我的应用程序,但我的应用程序ListFragment
不再正常工作。
当我单击列表的行时,onListItemClick
不再调用该函数。它曾经在 Android 3.0 和 Android 2.x 上正常工作
Android 4.x 是否有任何关于ListFragment
或 的变化onListItemClick
?
一种精度,我正在使用android-support-v4.jar 中的“ListFragment”
android.support.v4.app.ListFragment
这是我的ListFrangment
代码:
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);
}