MVC Pattern on Android

MVC pattern on Android

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.

Does Android supports MVC (Model View Controller) Structure?

Which design patterns are used on Android?

Model-View-Control works fine

The actual Activity class doesn't extend android's View class, but it
does, however, handle displaying a window to the user and also handle
the events of that window (onCreate, onPause etc).

This means, that when you are using a MVC pattern, your controller
will actually be a pseudo View-Controller. Since it is handling
displaying a window to the user, with the additional view components
you have added to it with setContentView, and also handling events for
atleast the various activity life cycle events.

In MVC, the controller is supposed to be the main entry point. Which
is a bit debatable if this is the case when applying it to android
development, since the activity is the natural entry point of most
applications.

So, Pseudo MVC in android :

Model = Entities or Classes with main Business Logic

View = layout, resources and widgets like EditText

Controller = Activity , Adaptor

Sample Image

Default Pattern MVC on Android


are that true?

No.

Could I have information that affirm or deny these statements

Android's view framework was not designed around any particular architecture. You are welcome to attempt to make your Android app adopt MVC, MVP, MVVM, etc., but none are an exact match.



Related Topics



Leave a reply



Submit