开发者

Add/Remove Items to Android ListView

I am creating a listv开发者_开发技巧iew as ListView listView = new ListView(context); in my activity and I code MyCustomAdapter that extends BaseAdaptor.setting this custom adapter to my listView.setAdapter(myCustomAdpObj) object that I created as above.Now at run time I want to add/remove elements from this listView.I did't find the method how I can do this?any suggestion?thanks


from your item array just remove or add item and call your adapter's notifyDataSetChanged()


remove/add an element and use this.

((BaseAdapter) listView.getAdapter()).notifyDataSetInvalidated();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜