Friday, 23 February 2018

Android MVP Tutorial From Beginer to Advance Part 1


android-mvp-tutorial
Android MVP Tutorial
This Tutorial is based on Android Mvp, and we are going to teach you MVP part by part basis . This is the first part and you can go to second part here to learn more .


Android MVP

Mvp is Model View Presenter . MVP is a pattern to make the Android code stay clean . In Android MVC Pattern , Code is very messy, but in MVP Pattern View is
neat and clean .

In this MVP pattern Article we will explain how to use this pattern in our Android apps. MVP is gaining importance in the development of Android applications   


What is MVP?

Mvp pattern, separate the logic from view . Logic is placed in presenter so to keep code neat and clean . Mvp pattern apply same logic but at presentation layer and keep the view dumb .

Is MVP a Pattern ?

No, Mvp is not a Pattern. Mvp works on presentation layer , or we can mention MVP responsible for presentation.

Why Use MVP ?

To Separate logic from view, Mvp is used . In Mvc every code is in view (Activity / Fragment ), for example,if i have to write code of LOGIN, then logic is placed in Activity or fragment and if there are more logic or more work of code in Acitvity/Fragment, So code is very messy in MVC. In Mvp logic is placed in Presentation and Activity view is placed as dumb .
Now the Activity/Fragment view is clean.

How to Use MVP ?

To use MVP, We have to make Model , View , Presenter.

View : View is used to Show Data to User . View get Data from Presenter and show as it is to User .

Presenter : Presenter is glue between View and Model. Presenter gets the data from Model and apply logic and send it to the View . Presenter get Post data from View and apply validation and send it to API request .

Model : Model is basically a class like Object, where data is stored . API response stored into Model and then send it to the presenter .

Go to Second part of Android MVP

I recommend you to download code after study part 3 of MVP

                                               DOWNLOAD CODE




0 comments:

Post a Comment