How to set GridView selection mode to multiple?

I have this line in my code:

myGridView.setChoiceMode(GridView.CHOICE_MODE_MULTIPLE);

It works fine in ICS, but crashes with 2.2 and 2.3.x with the following error:

java.lang.NoSuchMethodError: android.widget.GridView.setChoiceMode

However, look at the docs , tells me that the method is supported from API 1, although it is inherited from AbsListView. I also found this issue that reports a problem without a visible solution

Does anyone now have a workaround to this or have an idea on how to set the selection mode to several for all versions?

thank

+5
source share
1 answer

There is no solution to this problem, if you plan to use your code on API 10 or earlier versions, the implementation simply does not exist in these older versions of Android.

, GridView , . .

+5