Example usage for android.widget AdapterView setSelected

List of usage examples for android.widget AdapterView setSelected

Introduction

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

Prototype

public void setSelected(boolean selected) 

Source Link

Document

Changes the selection state of this view.

Usage

From source file:com.simas.vc.file_chooser.FileChooser.java

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    parent.setSelected(false);
    view.setSelected(false);//from  w w  w  .  j av a 2s . c  o m
    if (position != 0) {
        File file = mAdapter.getItem(position - 1);

        if (file.isDirectory()) {
            navigateTo(file);
        } else {
            getDialog().dismiss();
            if (mChoiceListener != null && file.exists()) {
                mChoiceListener.onFileChosen(file);
            }
        }
    }
}

From source file:com.scooter1556.sms.android.fragment.ConnectionFragment.java

@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    setEmptyText(getString(R.string.connections_empty));

    getListView().setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        public boolean onItemLongClick(AdapterView parent, View view, int position, long id) {
            getListView().startActionMode(actionModeCallBack);
            parent.requestFocusFromTouch();
            parent.setSelected(true);
            connectionListAdapter.setSelectedItemID(id);
            return true;
        }/*from   w w w  . jav  a 2s. co m*/
    });
}