Why Isn't An Adapter With Cached Buttons Working As Expected In Android?
Edit3: Exchanged the code for a complete runnable test case. Edit2: Added some code that updates the number of buttons after five seconds. When this happens the buttons becomes unc
Solution 1:
I think Android is reusing your views so that is causing you problems .I suggest you use a view holder .It is a static class that holds the view for you.See this tutorial
Solution 2:
The answer was quite simple, yet eluded me for many hours. Just override getItemViewType and the views won't be recycled. At least it seems to work for now. I still find the JavaDocs confusing on this.
publicintgetItemViewType(int position){
return AdapterView.ITEM_VIEW_TYPE_IGNORE;
}
Post a Comment for "Why Isn't An Adapter With Cached Buttons Working As Expected In Android?"