I gave this pattern to me named Mve (Model,view,eventbus). Model and view we all know, here is focused on Eventbus.
The Eventbus is a publish/Subscribe event bus optimized for Android. The main function is to substitute intent,handler,broadcast for passing messages between Fragment,activity,service and threads. The advantage is that the cost is small and the code is more elegant. and decoupling the sender and receiver.
OnCreate inside Register EventBus:EventBus.getDefault (). Register (this);
OnDestroy inside anti-registration EventBus:EventBus.getDefault (). Unregister (this);
Write a method in the activity or your fragment after the registration is written onEvent (event event)//name must be Onevent,event is the entity class in which the data is stored, and the data is processed in this method
The data returned by the asynchronous network request is parsed and placed inside the event entity class, calling Eventbus.getdefault (). Post (event); The OnEvent method that you have registered is executed.
An activity if more than one network requests the processing of different data, it is still written onevent method is only the event entity class is not the same, Eventbus will automatically distinguish. such as OnEvent (MyEvent event); OnEvent (Otherevent event)
An easy way for Android model and view decoupling (no write interface required)