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.

http://en.wikipedia.org/wiki/observer_pattern


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -