I would like to know if someone know some Android Framework to conventional applications. For example, a framework like rails which we can see easily the MVC pattern.
-
Create Models, Views and Controllers folder and you have a MVC pattern..? – Tascalator Apr 22 '14 at 19:44
-
Yeah, but i mean if you know some interesting framework to do it... Thanks – Franzé Jr. Apr 22 '14 at 20:12
-
I would think that MVC isn't required for Android or any mobile platform. To my understanding Android is already in MVC pattern. Don't you think? – Kunal B. Apr 24 '15 at 19:47
-
1Why do you think Android is already in MVC pattern? – Franzé Jr. Apr 25 '15 at 18:16
3 Answers
See answer here for an overview of Android's limitations, which will give you an idea of why an MVC pattern on Android has not yet emerged: http://www.quora.com/Is-there-any-standard-MVC-framework-in-Android-application-development-If-not-is-it-worth-developing-one
After having posted that answer I have gone ahead and built a fully-featured app using a single-Activity architecture. It allowed us to get past all the major UX limitations that were mentioned while being able to have arbitrary complexity in controller hierarchies (parents with children with sub-children etc.). Overall it worked out great, however you WILL have to build out specialized components (ie: custom back stack mechanism) as well as to store/restore state in a way that plays nicely with Android's own Activity/Fragment lifecycle patterns. There are also certain limitations around Fragment animations which had us pull our hair out at times, which required more custom component workarounds. ie: animations that show both an outgoing and incoming Fragment on-screen at the same time aren't supported on Android, so you will have to resort to taking screenshots of views and placing them into temporary ImageViews so that you create the appearance of transitions that show two fragments at the same time. In the end it's all possible, but you will have to be ready to work around annoying Android limitations while keeping an overall MVC architecture intact.
In summary: make your top-level component an Activity which is primarily responsible for top-level navigation (tab-based, menu-based, etc., as well as back stack and state preservation). The top-level component should not govern any particular screen of your app, instead it manages controllers for every top-level screen. The controllers are all Fragments, and can contain sub-controllers which are also Fragments. All screen transitions are performed using fragment transactions as opposed to Intents/Activities. Passing around data between Fragments is another point of contention as Android generally only supports data-passing through an Activity (ie: Fragment uses its parent Activity). But in this architecture you have need to have Fragments passing data to each other (either parent/child or sibling-sibling relationships).
I don't have this wrapped up into a framework or anything, but if your dev/arch team is sufficiently proficient the architecture is definitely worthwhile shooting for. You will come out with an app that is not subject to the traditional UX limitations of Android... something that very few Android apps can say they've achieved. Also... it generally feels awesome showing you can achieve the same level of UX that iOS apps have for years. It's about time isn't it??

- 3,334
- 5
- 37
- 27
-
I know that...I know that if you have good team is sufficiently good to create a good architecture. But my question was "I would like to know if someone know some Android Framework to conventional applications.". And not HOW TO do a MVC Framework with Android UX Limitations. But thank you very much for your response =) – Franzé Jr. Feb 28 '15 at 13:53
Don't know about the "conventional" part - Android does not play well with MVC architecture natively (mostly because Activities and Fragments take on responsibilities of both views and controllers), and I don't know if there is a standard framework for implementing MVC in Android.
I described some of my insights in more details in this answer.
That said, I created MVC (in fact MVP) template/tutorial application which demonstrates the approach I take to enforce MVP in my apps. You can use this app as tutorial, or clone/fork it and use as Android Studio template for your own apps. The source code is here: https://github.com/techyourchance/android_mvc_template
basically android has MVC pattern, but if you need more features like .net mvc you can use com.divankits.mvc module. Just see one of samples to find out how to use it. here is more details about module:
- bind properties to view(layout) objects
- you are able to create field validators
- convert model to json

- 81
- 1
- 5