Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GridView.setItemChecked(position, value)

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?

like image 799
fweigl Avatar asked Jun 05 '13 12:06

fweigl


1 Answers

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

like image 152
dzeikei Avatar answered Oct 12 '22 16:10

dzeikei