Example usage for android.widget AdapterView getItemIdAtPosition

List of usage examples for android.widget AdapterView getItemIdAtPosition

Introduction

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

Prototype

public long getItemIdAtPosition(int position) 

Source Link

Usage

From source file:tv.acfun.a63.MentionActivity.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    try {/*from ww w.  j  a va2  s.  c o m*/
        CommentsActivity.start(this, (int) parent.getItemIdAtPosition(position));
    } catch (IndexOutOfBoundsException e) {
        onClick(mFootview);
    }
}

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 . ja v a 2s .  co 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);
        }
    }
}