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'sView
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 withsetContentView
, 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 theactivity
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
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
Math.Random() Versus Random.Nextint(Int)
Should I Instantiate Instance Variables on Declaration or in the Constructor
Android Download Binary File Problems
Division in Java Always Results in Zero (0)
Ioexception: Too Many Open Files
Making a Java Package in the Command Line
Synchronized Block on Grails Works on Windows But No in Linux
Cannot Find Main Class on Linux - Classpath Issue
Could Not Reserve Enough Space For Object Heap
How to Convert an Arraylist Containing Integers to Primitive Int Array
Hiding Strings in Obfuscated Code
How to Add Parameters to a Http Get Request in Android
Select Random Document from Firestore
Connect to SQL Server from Linux via Jdbc Using Integratedsecurity (Windows Authentication)