Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android code design guidelines [closed]

Tags:

android

I have been developing embedded software in C for a few years for which I have been taught to use a layered architecture and I got used to it. Recently I made a switch to Android (and Java) and I am wondering if a similar approach is in use. OOP is also pretty new to me so at some points I am struggling at making good design choices. Are there any OFFICIAL design guidelines for the code of Android applications? I have seen a separation of activity and view related code, but I don't know if it is a good approach, and is something like this officially encouraged by Google.

like image 359
dragi Avatar asked Oct 01 '22 13:10

dragi


1 Answers

Android is based somehow in MCV paradigm. Basically, you define your views in xml files called layouts. Activities, fragments and widgets in a lower level let you control the functionality of your views. OOP is also present since you are able to define your own models.

Try to define all your views in XML files and take advance of OOP defining your own models related to Android (or custom) widgets. In activities and fragments you should implement all the listeners stuff and related.

Android developer has some great tutorials and guides: https://developer.android.com/guide/index.html

Anyway, this is a very wide question that can be answered in many and valid ways.

like image 129
Luciano Rodríguez Avatar answered Oct 05 '22 12:10

Luciano Rodríguez