Search code examples
javaandroid-studiolistviewadapter

AndroidStudio - ListView Adapter Update


Can listview adapter in JAVA for android studio update itself when a new data is added to it. like if i have an activity that sends a message and the sent message is displayed on the same activity, so whenever i send a message and add it to my adapter,will it update my listview on the spot or i need to refresh the current activity?


Solution

  • Use Recycler View and when the data change in fragment / activity you can add adapter.notifyDataSetChanged(); to update your list