I have this line in my code:
myGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE);
It works perfectly fine in ICS, but crashes with 2.2 and 2.3.x with the following error:
java.lang.NoSuchMethodError: android.widget.GridView.setChoiceMode
However a look at the docs tells me that the method is supported from API 1, though it's inherited from AbsListView
. I also found this issue that reports the problem with no apparent solution
Does anyone now a workaround to this, or have an idea how to set the choice mode to multiple for all versions?
Thanks
There is no solution to this problem if you intend your code to run on API 10 or earlier, the implementation simply isn't there on those older versions of Android.
If you really want a GridView to have a choice mode you will need write the code yourself. The best place to put the code is in your adapter implementation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With