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.
ANDROID MVP
Jeff Potter
@jpotts18
github.com/jpotts18
MOTIVATION
• Activities with millions of callbacks. God objects.
• Single Responsibility Principle
• https://github.com/an...
MVP RESPONSIBILITIES
• The model defines the data to be displayed or
acted upon.
• The view is a passive interface that dis...
MVP
ModelPresenterView
User Events
MVP
ModelPresenterView
User Events Update Model
MVP
ModelPresenterView
User Events Update Model
State Changed Event
MVP
ModelPresenterView
User Events Update Model
UpdateViews State Changed Event
LOGIN MVP
Network

Interactor
PresenterActivity
loginTapped
LOGIN MVP
Network

Interactor
PresenterActivity
loginTapped attemptLogin()
LOGIN MVP
Network

Interactor
PresenterActivity
loginTapped attemptLogin()
networkFailure()
networkSuccess()
LOGIN MVP
Network

Interactor
PresenterActivity
loginTapped attemptLogin()
networkFailure()
networkSuccess()
loginFailure(...
LET’STRY IT!
$ git clone git@github.com:jpotts18/android-mvp.git
GOAL
• Demonstrate MVP
• Switch out Model without affecting theView
• Switch out theView without affecting the Model
Upcoming SlideShare
Loading in …5
×

Android Architecture MVP Pattern

2,923 views

Published on

Explanation of Android MVP Architecture Pattern. This slide deck is used to explain the principles behind the pattern. It has a companion github repository which helps demonstrate the pattern.

https://github.com/jpotts18/android-mvp

Published in: Technology
  • Hello. I have downloaded your project https://github.com/jpotts18/android-mvp to explore but it will not compile. Error in the import package retofit, it does not exist. In both "build.gradle" no dependencies to Retofit. Could you help?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Android Architecture MVP Pattern

  1. 1. ANDROID MVP Jeff Potter @jpotts18 github.com/jpotts18
  2. 2. MOTIVATION • Activities with millions of callbacks. God objects. • Single Responsibility Principle • https://github.com/antoniolg/androidmvp • http://en.wikipedia.org/wiki/ Single_responsibility_principle
  3. 3. MVP RESPONSIBILITIES • The model defines the data to be displayed or acted upon. • The view is a passive interface that displays data and routes user events. • The presenter retrieves data from the model, and notifies the view to display it.
  4. 4. MVP ModelPresenterView User Events
  5. 5. MVP ModelPresenterView User Events Update Model
  6. 6. MVP ModelPresenterView User Events Update Model State Changed Event
  7. 7. MVP ModelPresenterView User Events Update Model UpdateViews State Changed Event
  8. 8. LOGIN MVP Network
 Interactor PresenterActivity loginTapped
  9. 9. LOGIN MVP Network
 Interactor PresenterActivity loginTapped attemptLogin()
  10. 10. LOGIN MVP Network
 Interactor PresenterActivity loginTapped attemptLogin() networkFailure() networkSuccess()
  11. 11. LOGIN MVP Network
 Interactor PresenterActivity loginTapped attemptLogin() networkFailure() networkSuccess() loginFailure() loginSuccess()
  12. 12. LET’STRY IT! $ git clone git@github.com:jpotts18/android-mvp.git
  13. 13. GOAL • Demonstrate MVP • Switch out Model without affecting theView • Switch out theView without affecting the Model

×