Example usage for android.widget AdapterView getOnItemClickListener

List of usage examples for android.widget AdapterView getOnItemClickListener

Introduction

In this page you can find the example usage for android.widget AdapterView getOnItemClickListener.

Prototype

@Nullable
public final OnItemClickListener getOnItemClickListener() 

Source Link

Usage

From source file:com.android.andryyu.lifehelper.widget.RippleView.java

/**
 * Send a click event if parent view is a Listview instance
 *
 * @param isLongClick Is the event a long click ?
 *///w  w  w.j  a  va2s .c  o  m
private void sendClickEvent(final Boolean isLongClick) {
    if (getParent() instanceof AdapterView) {
        final AdapterView adapterView = (AdapterView) getParent();
        final int position = adapterView.getPositionForView(this);
        final long id = adapterView.getItemIdAtPosition(position);
        if (isLongClick) {
            if (adapterView.getOnItemLongClickListener() != null)
                adapterView.getOnItemLongClickListener().onItemLongClick(adapterView, this, position, id);
        } else {
            if (adapterView.getOnItemClickListener() != null)
                adapterView.getOnItemClickListener().onItemClick(adapterView, this, position, id);
        }
    }
}