Architecture for Android app development

To begin with, Android does not force you to go for any architecture at all. What is more, it probably makes it a bit difficult if you try to follow to any. As a matter of fact, you need to be smart enough as a developer by not creating a ‘spaghetti codebase’. However, you may try to fit in any pattern you are familiar with, even though the best approach should originate from within your guts!


About the patterns, may be the three different ones will give you some idea about what does what in Android. Probably the Presenter/ModelView is somewhere in the Fragment or Activity. Adapters often do this job while taking care of inputs in the list. In all probability, Activities work like Controllers as well in many cases. All said and done, Models should be regular java files, while the View should be in layout resources, irrespective of some custom components that you are likely to implement. Now, let us proceed towards the next step.


File Organization, of which there are primarily two rational possibilities


  • Organize the whole thing by type – Creating one folder for all activities; another folder for all adapters, yet another folder for all fragments and so on.
  • Organize the whole thing by domain. As a result, everything associated with ‘ViewPost’ would go inside the same folder – the activity, the adapters, the fragment, etc. Same for ‘EditPost’, etc. The activities, in this process, would authorize the folders that have been created, plus there would be a few generic ones for base classes, for instance.


If you ask for my personal recommendation, I would like you not to take the first recourse, since there is very little or no advantage in having folder with innumerable unrelated files.

mobile apps development


At the time of creating layouts and styles, it is always advisable to name, or identifying them, by using a prefix for the activity (/fragment) where these are used. Thus all strings, styles, ids used in the context of ‘ViewPost’ should begin like:

“@id/view_post_heading” (for a textview for example), “@style/view_post_heading_style”, “@string/view_post_greeting”.


This will also optimize autocomplete, organization and circumvent name collision.


Base Classes

Base Classes, as you know are used for most of what you do: Activities, Adapters, Fragments, Services, whatever you may name. Incidentally, these prove fairly useful for debugging purposes, to let you know events that are happening in all your activities.

A word of caution: Keep in mind of your logging system right from the very beginning – you can use mobile apps development Logging System, provided you make a thorough use of it.