android - ArrayAdapter's add method adding twice -
i have iconicadapter
extending arrayadapter
:
class iconicadapter extends arrayadapter<string> { iconicadapter() { super(myservice.this, r.layout.activity_listview, r.id.text1, entries); } @override public view getview(int position,view convertview,viewgroup parent) { view row=super.getview(position, convertview, parent); imageview icon=(imageview)row.findviewbyid(r.id.img1); icon.setimageresource(r.drawable.ic_launcher); return(row); } }
when using add method, adding twice:
iconicadapter ia=new iconicadapter(); lv.setadapter(ia); ia.add("1000");
any reason why so?
i think problem this.
iconicadapter ia=new iconicadapter();`
you adding adapter list, here adapter.
lv.setadapter(ia);
then here wanted .
iv.add("1000"); here add in listview not in adapter
Comments
Post a Comment