android - Updating listview through fragments -


here problem have activity contains 2 fragments. fragment have listview , fragment b in charge of updating database don't know how update datas in listview inside fragment right after updating data in database fragment b. can me , give sample code this? lot.

in example, fragmenta call notify.

inotifier

public interface inotifier {     public void notify(object data); } 

utils

public class utils {     public static inotifier notifier; } 

fragmenta

public fragmenta extends fragment {     public void oncreateview(...) {     }     public void insomemethod() {         if (utils.notifier != null) {            utils.notifier.notify(data);         }    } } 

fragmentb

public fragmentb extends fragment implements inotifier {     public void oncreateview(...) {        utils.notifier = this;       }     @override    public void notify(object data) {        // handle data    } } 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

dataset - MPAndroidchart returning no chart Data available -

post - imageshack API cURL -