Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • Android MVP Model Overview, Advantages and How it Differs from MVC

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 1.92k
    Comment on it

    What is MVP:- MVP(Model View Presenter) is the best software design patterns for Android. MVP separates the application into three layers:


    Model: This holds the actual business logic of the application. which will allow us to perform and manage any business layer logic and data access, such as retrieving data from our Web service, Access to the database, etc.


    View: The View is a application interface that displays UI for particular activity when we execute application. When we take actions first it sends the data to presenter.


    Presenter: The presenter acts as a bridge between the view and model class. It calls during creation of any events from view controller or interaction with the interface to perform action.


    What is difference between MVC and MVP

    • In MVP, View doesn't have any interaction to access model.
    • In MVC,We put almost logic to handling data processing and notification
    • The Presenter is tied to a single View.
    • The View is completely passive in the MVP pattern.
    • Views can communicate directly with Model

    Advantage of using MVP

    • It's very understandable and easier code maintenance because it separated application's model, view and presenter in layers
    • Application components doesn't have conceptual relationship.
    • Its much easier to test components in isolation


    The Model View Presenter Architecture for Android

    Image Source:*smJy5uFyF5qucw6_7svnQA.png

    In this Architecture as you can see that view ( activity, fragment) take any actions like button events, call api then view navigate to presenters class where place business  logic. As Presenter class get events from view then it call Model class. Model do execution and back to Presenter class. Presenter class back do update View Class.


    Note: Please download complete demo from below attached file.

    In this demo, We created single Model and Presenter class to whole application. I did not tried to have separated Model and Presenter class for each View as you have seen ever.

    For any questions, please feel free to write in comments.




    Android MVP Model Overview, Advantages and How it Differs from MVC

 0 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: