When developing an Android app it is important to plan the architecture of the project. This will allow us to create complex, robust, good quality, easy to maintain applications.
Today I want to show you my approach to using the recommended practices in Android development.
As you know, writing all of our app code in an Activity or Fragment is a common mistake. We should separate the different concerns of our app components. This next diagram will show you the modules and their interactions that we will be using:
Android Architecture Components
We will be using the Rick and Morty API, from where we will extract character information to show them in a RecyclerView, and by clicking one of its items the app will display the detail of one character. Simple.
The app
And this is the project’s folder structure:
Folder Structure
That could seem like a lot. Here is some explanation:
**data: **Our M (Model) in MVVM. Where we perform data operations.
**di: **Dependency Injection with the help of Hilt.
ui: Our Fragments and ViewModels helping to display data to the user.
utils: Helper classes and functions.
I recommend that you have a look at the GitHub repository while you follow this tutorial.
#android-architecture #mobile-app-development #dependency-injection #android #kotlin