Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Infinum Android Talks #12 - MVP design pattern for Android Apps

In this talk, we'll show you how and why to use the Model View Presenter design pattern on Android with a simple practical example.

Infinum Android Talks #12 - MVP design pattern for Android Apps

  1. 1. MVP design pattern Dino Kovač
  2. 2. Example app - list
  3. 3. Example app - details
  4. 4. Architecture Model Presenter View
  5. 5. View • Activity, Fragment, View… • has a reference to the Presenter • propagates events from the UI to the presenter
 (onClicks, lifecycle events) • exposes methods that control the presentation of data
 (show / hide the loading layout)
  6. 6. Presenter • middle-man between the View and Model • has a reference to the View and Model • introduces a level of abstraction to the data from the Model and formats it before sending it to the View
 - this makes the View and Model independent • updates the UI - the difference from MVC!
  7. 7. Interactor (Model) • gateway towards the business logic • contains methods for data retrieval • in practice we use an Interactor
  8. 8. Conventions • mvp • views • XyView • listeners • XyListener • presenters • XyPresenter • impl • XyPresenterImpl • interactors • XyInteractor • impl • XyInteractorImpl
  9. 9. Dependencies PokemonDetailsView PokemonDetailsPresenter PokemonDetailsInteractor PokemonDetailsView Implementation PokemonDetailsPresenter Implementation PokemonDetailsInteractor Implementation
  10. 10. Resources • http://antonioleiva.com/mvp-android/ • https://github.com/reisub/Dagger-2- Example

×