问题
I have a ListView
and ListView
adapter. I am adding objects to the adapter but I only want to add one row with an object that contains a certain String
. This is my code but it does not work:
public static List<FriendsVideoLVModel> list = new ArrayList<FriendsVideoLVModel>();
@Override
public void add(FriendsVideoLVModel obj) {
super.add(obj);
for (int i=0; i <list.size(); i++) {
if (!obj.eventTitle.equals(list.get(i).eventTitle)) {
list.add(obj);
notifyDataSetChanged();
}
}
}
Please help. The logic looks fine to me but it just does not work. Nothing is in fact added.
来源:https://stackoverflow.com/questions/28825038/arrayadapter-contains-an-object-based-on-a-value