0

I want to update the listView when user adds a value... I used SimpleAdapter and hashmap But shows only one value when add button is clicked. When I enter a value again and press the add button, ListView does not show it! Please help....

saeedar
  • 305
  • 2
  • 19

2 Answers2

1

Maybe a missing :

adapter.notifyDataSetChanged();
cid
  • 696
  • 1
  • 8
  • 19
  • adapter.notifyDataSetChanged(); is not there.... I'm using list adapter. That function is not there... Only notify() and notifyAll() is shown – saeedar Feb 18 '14 at 14:41
  • "list adapter", you mean SimpleAdapter? That's because SimpleAdapter is intended to be used only for _static_ data. Try to use another adapter, like ArrayAdapter for example. – cid Feb 18 '14 at 21:35
0

Once you have added or deleted a value from the hashmap associated with your list adapter, call:

adapter.notifyDataSetChanged();

If its still not updating, check this answer.

Community
  • 1
  • 1
amalBit
  • 12,041
  • 6
  • 77
  • 94
  • adapter.notifyDataSetChanged(); is not there.... I'm using list adapter. That function is not there... Only notify() and notifyAll() is shown – saeedar Feb 18 '14 at 14:50