I think confusion can arise with the definition of a view as XML, and therefore activity is mistakenly perceived as a point of view. Not this. You pass the view (your XML layout) to the Activity, which then inflates the views contained in the XML layout. Your activity also transfers data (models) to your views (EditText, TextView, extended version of base views, etc.).
If you really want MVC, you can achieve this by simply customizing your view in the XML layout, create a view object that extends from your root view (if this RelativeLayout extends from this). From there, you add your accessors and other logic needed for this view, and then you can add unit testing around this.
In action, you will no longer pass the layout id and instead do something like this:
CustomView customView = new CustomView(...); setContentView(customView); ...
Of course, almost all applications will not do this, and you really don't need to do this. A call to findViewById is enough to bind this object and call the methods that it has. This, in my opinion, is MVC.
Codyengel
source share