5

I want to use a Master-Detail-Flow with a GridView on the left (master) side. According to the documentation, GridView has a method setItemChecked(position, value) that was added in API level 1. Eclipse however states that the method requires API level 11.

Which one is true? If I want to have checked items in my GridView, do I need to implement the logic (with background changes etc) myelf?

fweigl
  • 21,278
  • 20
  • 114
  • 205

2 Answers2

5

From my experience, the official documentation is wrong.

AbsListView.setItemChecked(position, value) only exists from HoneyComb (API 11) onwards. What makes it confusing is that ListView.setItemChecked(position, value) did exist from API 1 while GridView.setItemChecked(position, value) didn't. I think it was just bad API design that was fixed in API 11.

Maybe it's due to a limitation in the documentation generator because the method was moved up the inheritance chain to AbsListView in API 11. The method in AbsListView should be marked as Added in API level 11 while the method in ListView should be marked as Added in API level 1.

I haven't used it but someone has created a GridViewCompat to fix this issue. https://github.com/paramvir-b/AndroidGridViewCompatLib

dzeikei
  • 2,256
  • 1
  • 21
  • 27
0

I believe the documentation is wrong. Testing on an emulator, the method was not available on API level 8. This applies for all extensions of the AbsListView setItemChecked() method as far as I can tell (ListView etc). I think it's safe to assume it's only available on API level 11+

Tim Malseed
  • 6,003
  • 6
  • 48
  • 66