android - Notifying adapter from model -
i'm trying make changes android application adopting mvp pattern, i'm having trouble notify adapter recyclerview using.
what i'm doing giving reference adapter in model , notifying changes made when click events happen, so:
public class mymodel { private myadapter adapter; ... public void setadapter(myadapter adapter) { this.adapter = adapter; } public void action() { // make changes model , notify adapter changes // made individual items ... adapter.notifyitemchanged(position) } }
i'm wonder conventional way of handling kind of behaviour using mvp pattern.
the observer pattern might looking for. when changes made model can notify observers (the presenters) can update view.