Jesse-
Jesse-

Reputation: 15

Updating ListView after change to database

I've been creating a simple list app with a TabLayout to store and view several types of things. I've drawn up the structure of my app below.

From the ListView I can click on an item, this launches a DialogFragment that retrieves the item from the database and allows me to edit and save the entry.

Overlaying the ListView, from the MainActivity, I have a FloatingActionButton. This launches the same DialogFragment, this time without content.

This all works just as expected.

What I cannot figure out, however, is how to refresh the ListView after dismissing the DialogFragment (be it after an edit or new entry).

Any pointers to how I can make this happen would be greatly appreciated!

My app structure

Upvotes: 0

Views: 53

Answers (1)

Adnan Bashir
Adnan Bashir

Reputation: 763

when you perform data modification ,when its done you call

adapter.notifyDataSetChanged(); 

if you are using asynctask then you call this lin in

onPostExecte(){ // here }  

Upvotes: 1

Related Questions