Example usage for android.widget AdapterView requestFocusFromTouch

List of usage examples for android.widget AdapterView requestFocusFromTouch

Introduction

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

Prototype

public final boolean requestFocusFromTouch() 

Source Link

Document

Call this to try to give focus to a specific view or to one of its descendants.

Usage

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);/*from  w  w  w.  j  av a  2 s .c o  m*/
            connectionListAdapter.setSelectedItemID(id);
            return true;
        }
    });
}