Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android model view presenter/controller examples [closed]

are there any good examples or tutorials on how best to structure an android applications anywhere?

am new to java and android and i've built winforms apps using passive and supervising controller variants of model view presenter and model view controller in asp.net but not really seen any examples or code on android that use these sorts of patterns.

how do people structure decent size android apps out there in the wild. are there any best practices or should i be sticking rigidly to official android documentation.

like image 374
solrevdev Avatar asked Dec 01 '10 00:12

solrevdev


People also ask

What is MVP Android?

Model–view–presenter (MVP) is a derivation of the model–view–controller (MVC) architectural pattern which mostly used for building user interfaces. In MVP, the presenter assumes the functionality of the “middle-man”. In MVP, all presentation logic is pushed to the presenter.

What does presenter do in MVP?

Presenter: The last part is the presenter, which handles UI updates based on changes to the data model, and also processes users inputs. The presenter will contain much of the business code and replaces the controller from MVC.

What is MVP design pattern?

The MVP pattern is similar to the MVC pattern. It is derived from MVC pattern, wherein the controller is replaced by the presenter. This pattern divides an application into three major aspects: Model, View, and Presenter. Model. The Model represents a set of classes that describes the business logic and data.


2 Answers

Try with the following two examples. I've found them useful in understanding how MVP might apply to Android applications.

http://web.archive.org/web/20120524010643/http://chicagoandroid.com/forum/topics/mvp-android-perspective

http://web.archive.org/web/20130525044856/http://jamespeckham.com/Blog/10-11-21/MVP_on_Android.aspx

like image 146
superjos Avatar answered Oct 08 '22 13:10

superjos


Also Mosby implements an MVP pattern plus other things, but it is modular enough so that you can use only the MVP part and forget about the rest.

There is also a nice blog post covering the motivations and choices of this library

like image 30
Julian Suarez Avatar answered Oct 08 '22 12:10

Julian Suarez