0

I have a listview in my android application . This List View is filled with Messages. Now i want to give the user a ability to select multiple messages and then delete them or move them. Clicking on the List Item displays the message details. Now i want some suggestions . 1) How can i give the user the ability to select multiple messages? check box or some other method? I use the messagesListView.setOnItemClickListener(this); to get the message that was clicked on ? My Custom Adapter, i have overridden the setOnLongClickListener to get the long click on a List Item . But somehow this acts really strange . Like when i want to long click the short click listener is fired ? Am i making sense ? My question is how can i give the user an efficient way to select multiple items in a ListView ?

AndroidDev
  • 15,993
  • 29
  • 85
  • 119
  • please check this answer http://stackoverflow.com/questions/3825645/android-listview-with-multiple-select-and-custom-adapter – rajpara Jun 18 '12 at 13:51

3 Answers3

0

CheckBox is the best way to achieve multiple selection for listview. Also you don't have to implement onItemClick() for this purpose. Even almost every android application give the same functionality with CheckBox.

Tutorial Custom ListView with ability to check items

user370305
  • 108,599
  • 23
  • 164
  • 151
  • Please this is unexpected from you that you haven't given this link: http://stackoverflow.com/questions/3825645/android-listview-with-multiple-select-and-custom-adapter – Paresh Mayani Jun 18 '12 at 13:55
0

the android platform has definition for CheckedTextView.. try that if u want

skaur
  • 168
  • 2
  • 11
0

You haven't said what version you are developing for, so it's kind of hard to give the best advice.

If you are developing for API 11+, you should use the contextual action mode with batch operation support. See the docs here for more info.

Barak
  • 16,318
  • 9
  • 52
  • 84