Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.48 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Set selection on longClick?
  2. listView.setOnItemLongClickListener(new OnItemLongClickListener() {
  3.             @Override
  4.             public boolean onItemLongClick(AdapterView<?> parent, View view,
  5.                   int position, long id) {
  6.                 listView.setSelection(position);
  7.                 return true;
  8.             }
  9.         });
  10.        
  11. listView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
  12.        
  13. listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
  14.        
  15. view.setSelected(true);