android - Listview and array adapter and remove -
android - Listview and array adapter and remove -
i created adapter
public class myarrayadapter extends arrayadapter<watch>
overriding
public myarrayadapter(context context, list<watch> values){ super(context, android.r.layout.simple_list_item_1, values); this.context = context; }
and
private view createoneview(){ ... }
then do
myarrayadapter myadapter = new myarrayadapter(this, getallwatches()); ... //do stuff here myadapter.remove(getallwatches().get(2)); myadapter.notifydatasetchanged();
the watch still not removed. suspect objects removed if ther ==
, not .equal()
, or missing more trivial?
myadapter.getposition(getallwatches().get(2))
homecoming -1, problem object not found. arrayadapater uses indeed .equals()
method. implementing in appropriate way (comparingfields) works smoothly.
android listview
Comments
Post a Comment