There is no universally unique MVC pattern in android . MVC is a concept rather than a solid programming framework, so it is about conceptual understanding of MVC. We can implement our own MVC in any platforms. As long as we stick to the following basic idea, we are implementing MVC:
- Model: What to render
- View: How to render
- Controller: Events, user input
we can say MVC is already implemented in Android as:
- View = layout, resources and built-in classes like Button derived from
android.view.View
. - Controller = Activity
- Model = the classes that implement the application logic
Also we can think about this way, when we program our model, the model should not need to worry about the rendering (or platform specific code). The model would say to the view, we don't care our 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.
- 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 model
- A lot of Utils have been already written for you. DatabaseUtils, Html,
Please visit the Blog for information.
No comments:
Post a Comment