Home > DeveloperSection > Forums > MVC pattern in Android?
Pooja Malohtra
Pooja Malohtra

Total Post:47

Points:331
Posted on    January-02-2015 11:08 PM

 Android Android  Mvc 
Ratings:


 1 Reply(s)
 697  View(s)
Rate this:

In Android you don't have MVC, but you have the following:


You define your user interface in various XML files by resolution, hardware, etc.

You define your resources in various XML files by locale, etc.

You extend clases like ListActivity, TabActivity and make use of the XML file by inflaters.

You can create as many classes as you wish for your business logic.

A lot of Utils have been already written for you - DatabaseUtils, Html.



Tom Cruser
Tom Cruser

Total Post:28

Points:196
Posted on    January-02-2015 11:39 PM

There is no universally unique MVC pattern. MVC is a concept rather than a solid programming framework. You can implement your own MVC in any platforms. As long as you stick to the following basic idea, you are implementing MVC:

Model: What to render
View: How to render
Controller: Events, user input
Also think about this way, when you program your model, the model should not need to worry about the rendering (or platform specific code). The model would say to the view, I don't care your rendering is Android or iOS or Windows Phone, this is what I need you to render. The view would only handle the platform specific rendering code.

This is particularly useful when you use Mono to share the model in order to develop cross platform applications.

Don't want to miss updates? Please click the below button!

Follow MindStick