lucasr / smoothie

[DEPRECATED] Easy async loading for Android's ListView/GridView
985 stars 163 forks source link

Don't use AbsListView.setAdapter on SDK_INT < HONEYCOMB #2

Closed luciofm closed 11 years ago

luciofm commented 11 years ago

AbsListView.setAdapter is only available for SDK_INT >= HONEYCOMB

E/AndroidRuntime(20694): FATAL EXCEPTION: main
E/AndroidRuntime(20694): java.lang.NoSuchMethodError: android.widget.AbsListView.setAdapter
E/AndroidRuntime(20694):    at org.lucasr.smoothie.ItemManaged.setItemManager(ItemManaged.java:72)
E/AndroidRuntime(20694):    at org.lucasr.smoothie.AsyncGridView.setItemManager(AsyncGridView.java:66)

On lower versions, cast it to GridView or ListView.

lucasr commented 11 years ago

Nice catch! Thanks! The patch looks good but there's a bit of code duplication in there. Could you please move the code to set the adapter into a private "setAdapterOnView(ListAdapter adapter)" method?