Example usage for android.widget AdapterView getOnItemLongClickListener

List of usage examples for android.widget AdapterView getOnItemLongClickListener

Introduction

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

Prototype

public final OnItemLongClickListener getOnItemLongClickListener() 

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 ?
 *//*from   w ww. j a v a2 s. c  om*/
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);
        }
    }
}