1

I implemented simple Listener to swipe actions on RelativeLayout. But I want to use my onClick method, and I don't know how to fire selecting Layout, I mean this Layout has

android:background="?android:attr/selectableItemBackground"

this background value to see that someone clicked on this layout.

This is my Listener

public interface SwipeListener<T> {
        boolean swipeLeft(T itemData);
        boolean swipeRight(T itemData);
        void onClick(ViewHolder holder);
        void onLongClick(ViewHolder holder);
}

I am getting reference to RelativeLayout form ViewHolder which I implemented, but I don't know how to fire selecting this layout in order to see ripple effect ?

Nominalista
  • 4,632
  • 11
  • 43
  • 102
  • A view has two methods for this, performClick() and callOnClick(). http://developer.android.com/intl/ja/reference/android/view/View.html#performClick() – ElDuderino Dec 07 '15 at 15:59
  • But both requires clicklistener. If I add clickListener they are confusing what to call. – Nominalista Dec 07 '15 at 16:06
  • You need a ClickListener to do something when you perform a click, but that has nothing to do with the click event itself, using callOnClick() should do what you ask for. – Nanoc Dec 07 '15 at 16:11
  • No because in OnClick method I am adding ClickListener and then I am using callOnClickl(). After first time everything is ok, but after second and next times application is using new ClickListner instead of SwipeListener which I implemented – Nominalista Dec 07 '15 at 16:15
  • Maybe you can show us the code in question, how you call it, instead of this not so useful interface definition. – ElDuderino Dec 07 '15 at 17:25

0 Answers0