Android Context Action Panel (CAB) on GridView and onClickListener

I have a gridview with images, and I use CAB to select multiple images in a grid

 gridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE_MODAL);
 gridView.setMultiChoiceModeListener(new AbsListView.MultiChoiceModeListener() { .... }

CAB is activated by long pressing. But when I click on the image, I want to start another action. If I implement setOnClickListener in the adapter, CAB activation stops working and onClick is always called. Even if I try to make a long click

How to save my onClickListener and activate CAB with long press?

+4
source share
1 answer

Just set mGridView.setOnItemClickListener for one click and mGridView.setMultiChoiceModeListener for long click CAB.

: http://developer.android.com/intl/es/guide/topics/ui/menus.html#CAB

+1

Source: https://habr.com/ru/post/1526077/


All Articles