1

I got a fragment with a ListView. The purpose of the list is simply checking items in that list, so I want to add something to the onCreateView method which will make the list enter its multiple selection mode automatically as the fragment shows, without the need for the user to long press an item. How can I do that?

Cœur
  • 37,241
  • 25
  • 195
  • 267
JJ Ab
  • 492
  • 4
  • 15
  • onCreateview() just show multiple selection listiview instead of simple listview if there is no more purpose than this. @JJ Ab – Amit Vaghela Jan 07 '16 at 06:34
  • OK and that is exactly the question - how? I know how to set it for multiple selection but it is only triggered by a long click. How do I trigger it programatically? – JJ Ab Jan 07 '16 at 06:51

1 Answers1

0

to use longpress , you can do this way,

android:choiceMode="multipleChoiceModal" 
or
setChoiceMode(ListView.CHOICE_MODE_MULTIPLE_MODAL)

go through this for more information

Community
  • 1
  • 1
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
  • You got it wrong. A ListView in Android can be set to a multiple selection mode. After doing so, the list enters this mode when a user is long clicking a list item. I am not asking how to do something when long clicking. I'm asking how to enter the multiple selection mode WITHOUT the need for a long click. – JJ Ab Jan 07 '16 at 07:01
  • Again you got it wrong. Your edit only shows me how to set the list so when a user long click it, it will enter a multiple selection mode. I'm asking how to enter that multiple selection mode programatically WITHOUT LONG PRESS. NOT with. Without. – JJ Ab Jan 07 '16 at 07:08
  • sounds more like what I want but the answer is not something that is logical to do. its a very bad hacking.. that answer is from 2013. maybe there were some changes since then? – JJ Ab Jan 07 '16 at 08:26