I want to refresh BaseAdapter
which is in fragment
. I am showing bluetooth list using BaseAdapter
. I want to refresh this list on Refresh button
click and want show on Listview
in Fragment
.
What should I do for this?
Asked
Active
Viewed 94 times
-5

UltimateDevil
- 2,807
- 2
- 18
- 31

Shekhar Jadhav
- 1,035
- 9
- 20
-
2Simply try to use notifyDataSetChanged() to notify the adapter to refresh the listvew. – yash786 Oct 13 '17 at 05:53
-
4Possible duplicate of [How to refresh Android listview?](https://stackoverflow.com/questions/2250770/how-to-refresh-android-listview) – AskNilesh Oct 13 '17 at 05:58
2 Answers
2
Try this .
public class PersonAdapter extends BaseAdapter {
private ArrayList<PersonBean> mList;
private Context mContext;
public PersonAdapter(ArrayList<PersonBean> list, Context context) {
mList = list;
mContext = context;
}
public void refresh(ArrayList<PersonBean> list) {
mList = list;
notifyDataSetChanged();
}
...
When click
mAdapter.refresh(mList);

KeLiuyue
- 8,149
- 4
- 25
- 42
0
Update your data collection, such as Array or List, and do BaseAdapter.notifyDataSetChanged();

RRTW
- 3,160
- 1
- 35
- 54