Skip to content Skip to sidebar Skip to footer

How To Access Ui Elements Created By A List Adapter From An Activity?

In my code now, I have a DetailActivity, which simply calls a ListAdapter class to populate a ListView. Within the ListAdapter class, I am inflating some custom views, some of whic

Solution 1:

I assume you have a List<Object> that is sent through the constructor of ListAdapter. Just add a boolean isEnable to the Object, and then in your getView() method, add this line:

button.setEnabled(getItem(position).isEnable);

In your DetailActivity, you can changeisEnable as you wish. And remember to adapter.notifyDataSetChanged() to get it worked.

Post a Comment for "How To Access Ui Elements Created By A List Adapter From An Activity?"