So I have a GridView that implements the multiple choice mode listener , and every time the user taps the item it should change it's background image ; and when he/she long taps , the multi choice toolbar should appear.
However since I have on click listener in getView() it somehow blocks the other one.
(if I remove the listener from getView() , the other one works just fine)
Any advices ?
Here's my code:
MultiChoiceListener:
gView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
checkedPos = new SparseBooleanArray();
gView.setMultiChoiceModeListener(new GridView.MultiChoiceModeListener() {
@Override
public void onItemCheckedStateChanged(ActionMode mode, int position, long id, boolean checked) {
currentArray = gView.getCheckedItemPositions();
int itemCount = gView.getCheckedItemCount();
switch (itemCount){
case 1:
mode.setSubtitle("One item selected.");
break;
default:
mode.setSubtitle(itemCount + " items selected.");
break;
}
...
getView():
convertView.setLongClickable(true);
final Holder finalHolder = holder;
convertView.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!pressed) {
finalHolder.img.setBackground(ContextCompat.getDrawable(context, R.drawable.ic_pause_bg));
pressed = true;
}
else{
finalHolder.img.setBackground(ContextCompat.getDrawable(context, R.drawable.ic_noise_bg));
pressed = false;
}
}
});
Thank you for your time!