Example usage for android.widget ListPopupWindow getSelectedItemId

List of usage examples for android.widget ListPopupWindow getSelectedItemId

Introduction

In this page you can find the example usage for android.widget ListPopupWindow getSelectedItemId.

Prototype

public long getSelectedItemId() 

Source Link

Usage

From source file:com.duy.pascal.ui.editor.view.CodeSuggestsEditText.java

private void performCompletion(View selectedView, int position, long id) {
    if (isPopupShowing()) {
        Object selectedItem;// w  w  w. j av a2 s. com
        if (position < 0) {
            selectedItem = mPopup.getSelectedItem();
        } else {
            selectedItem = mAdapter.getItem(position);
        }
        if (selectedItem == null) {
            DLog.w(TAG, "performCompletion: no selected item");
            return;
        }

        mBlockCompletion = true;
        try {
            replaceText(convertSelectionToString(selectedItem));
        } catch (Exception ignored) {
            //something wrong when start app
            ignored.printStackTrace();
        }
        mBlockCompletion = false;

        if (mItemClickListener != null) {
            final ListPopupWindow list = mPopup;

            if (selectedView == null || position < 0) {
                selectedView = list.getSelectedView();
                position = list.getSelectedItemPosition();
                id = list.getSelectedItemId();
            }
            mItemClickListener.onItemClick(list.getListView(), selectedView, position, id);
        }
    }

    if (mDropDownDismissedOnCompletion) {
        dismissDropDown();
    }
}