0

I'm using Cards from the CardsLib library inside a CardGridView. I'm able to catch single clicks OR long clicks when implementing one of the listeners, but I'm unable to implement both. Like for regulars views, I'm returning true in the OnLongCardClickListener to consume the event.

 MaterialLargeImageCard myCard = MaterialLargeImageCard.with(getActivity())
      {...}
      .build();
 myCard.setOnLongClickListener(new Card.OnLongCardClickListener() {
      @Override
      public boolean onLongClick(Card card, View view) {
           return true;
      }
 });
 myCard.setOnClickListener(new Card.OnCardClickListener() {
      @Override
      public void onClick(Card card, View view) {
      }
 });
Jérémy
  • 263
  • 1
  • 3
  • 10

1 Answers1

0

try this ,

 myCard.setOnLongClickListener(this); 
 public void onClick(View view) {
 }
  • Not working, setOnLongClickListener takes an OnLongCardClickListener as a parameter and has to override onLongClick. – Jérémy Sep 26 '16 at 20:26
  • hmmmm i just try to help :) –  Sep 26 '16 at 20:29
  • Please edit with more information. Code-only and "try this" answers are discouraged, because they contain no searchable content, and don't explain why someone should "try this". – abarisone Sep 27 '16 at 14:37
  • I finally gave up with CardsLib and used the native CardView with RecyclerView and everything is working like a charm. – Jérémy Nov 02 '16 at 18:04