Use LongClickListener in ListActivity

29 Views Asked by At
protected void onListItemClick (ListView l, View v, int position, long id)

The normal method works fine for me but is there also a method for a long click? Since I am on a ListActivity I cant use:

listview.setOnItemLongClickListener(new OnItemLongClickListener() 

because i cant initialize listView bc of ListActivity.

1

There are 1 best solutions below

0
GBCode On BEST ANSWER

OK I found a nice solution for it:

ListView lv = getListView();
    lv.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
        @Override
        public boolean onItemLongClick(AdapterView<?> arg0, View arg1, int row, long arg3) {

             System.out.println("REIHE "+row);
             return true;

        }
    });