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
Post a Comment