开发者

How to refresh dynamic listview?

开发者 https://www.devze.com 2023-03-12 01:56 出处:网络
I have 开发者_JAVA技巧a dynamic listview and I want to refresh the list when any new item is added.

I have 开发者_JAVA技巧a dynamic listview and I want to refresh the list when any new item is added. How can I do this.Pls help me.

Thanks, Monali


Call notifyDataSetChanged() on your adapter


Here is a demo for how u can do that http://www.softwarepassion.com/android-series-custom-listview-items-and-adapters/


USE setListAdapter(yourAdapter);

Make your adapter to ListAdapter find more details here

then just use

yourAdapter.notifyDataSetChanged(); and you are done !


1) create a method

2) set adapterView in that method.

3) at click event of any image button call that method.

or to put Adapter.notifyDataSetChanged();

I think this would be easy for you.


Also you can do this like... I have custom row for list. It has textview and I can change it's value ...

((TextView)(myWatchList.getChildAt(INDEX - myWatchList.getFirstVisiblePosition()).findViewById(R.id.symbolCountTV))).setText(NEWSTRING);
0

精彩评论

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