Do you know what does BMI mean, or did you already measured your BMI? Doesn’t matter, because in this tutorial you are going to build up a BMI calculator app, where you can calculate it and store it for the future. Below you can find the introduction.
What is BMI?
Frist of all, we need to clarify what does BMI mean in case if this value is not known for you.
So, BMI means:
Body mass index (BMI) is a value derived from the mass (weight) and height of a person. The BMI is defined as the body mass divided by the square of the body height, and is universally expressed in units of kg/m2, resulting from mass in kilograms and height in metres.
Below you can find a short video about the BMI application, what you are going to build up in the next lectures.
As you can see on the video above, we are going to build a realy fancy application with a modern user interface.
- We are going to define this layout by our own in Android Studio
- we are going to specify the colors and positions of the views also.
Behind the hood this app will use many Jetpack libraries, which is the current recommendation of Google.
We gonna use
- Data Binding
- Navigation Component
I think you could already figure out, that we gonna follow the MVVM design pattern. It means we will create a repository, a viewmodel and a UI layer.
MVVM separates the view (which is in Android: Fragment and Activity) from the business logic.
- Model: This holds the data of the application. A model can’t directly communicate with the view.
- View: It represents the user interface of the application. The view observes the ViewModel, which provides the data.
- ViewModel: This is the layer, which connects the data with the view. The ViewModel acts as a link betweent them. When the user does something in the view, then the ViewModel will change data regarding the event and provide it for the user interface.
In our application later on we are going to refactor our app to use dependency injection.
First of all, we have to talk about dependency injection. In software engineering, dependency injection is a technique, a design pattern whereby one object supplies the dependencies of another object.
We can create the dependent object outside of the class and provide those object to class from different ways. DI can help with, moving the creation and binding of the dependent objects outside of the class that depends on them.
In our app we are going to use Koin. If you would like to read more about how does Koin works, then check out our basics tutorial.
The last part of this tutorial will be a basic description how does the testing works in Android development.
- First, we are going to create unit tests for the calculations.
- Then we will test the navigation inside of our app.
- Finally we will test the insert and get methods of the Room database.
As we have done in other tutorials, this course will be also available on GitHub.
You will find the repository at the end of the next lecture.
I hope the description was understandable and clear. But, if you have still questions, then leave me comments below! 😉
Have a nice a day! 🙂