I\'ve got a silly little problem. I\'ve registered a ListFragment
both as OnItemClickListener
and OnItemLongClickListener
of its own
My solution:(trick)
final ListView lvMain = (ListView) activity.findViewById(R.id.listTHEMES);
lvMain.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
lvMain.setItemsCanFocus(false);
ArrayAdapter adapter = new ArrayAdapter(activity,
android.R.layout.simple_list_item_multiple_choice, ArrayTheme);
lvMain.setAdapter(adapter);
lvMain.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView> arg0, View arg1,
int pos, long id) {
// TODO Auto-generated method stub
if (lvMain.isItemChecked(pos)){lvMain.setItemChecked(pos,false);}else{lvMain.setItemChecked(pos,true);}
Log.v(LOG_TAG,"long clicked pos: " + pos);
//lvMain.setSelection();
return true;
}
});
lvMain.setOnItemClickListener(new AdapterView.OnItemClickListener() {
public void onItemClick(AdapterView> parent, View view,
int position, long id) {
//Log.d(LOG_TAG, "itemClick: position = " + position + ", id = " + id);
if (lvMain.isItemChecked(position)){lvMain.setItemChecked(position,false);}else{lvMain.setItemChecked(position,true);}
}
});