Read Message from Static Website Form using Firebase Realtime Database

Advantages of using Static Website. To using static website for hosting your homepage have many advantages. The side is loaded fast, it’s cheap or even free to host your side. If you whant to host a blog you can use Jekyll or Hugo But there is a problem. Data from the forms, like contact or comment etc, can not be aquired in a good way. This article describes how you can use the Realtime Database provided by Firebase to save the data and then read them in an Android app.

Read More »

View Binding

Why use View Binding? In this article we look how to use View Binding to find and configure your views. Since the beginning the findViewById(id: Int) have been used for finding the View object in Activities, Fragments and Views. There is nothing wrong with this method. But View Binding has important advantages. Null Safty: View Binding creates direct references to views, so there is no risk of a null pointer exception due to an invalid view ID.

Read More »

Unit Testing ViewModel

This post describes how to Unit Test the ViewModel in MVVM. If you don’t know what MVVM is, please read Basic MVVM in Android first. Why Write Unit Test? It will help you to structure the code and you can tested it before writing the View. You can also create fake Models and create the View without any need for a connection to a database or a server. You can prevent to break the code in the future.

Read More »

Model Injection using MVVM

This post will handle the Model of MVVM. If you don’t know about View or ViewModel, please read Basic MVVM in Android first. Model as a Singleton The Model of the MVVM is a singleton. In Kotlin you can declare it as an object. But, there are two problems! What if the Model need a reference to the application or other static data? During unit testing the Model has no access to the hardware, like the file system.

Read More »

Basic MVVM in Android

What is MVVM? MVVM stand for View - ViewModel - Model and is a way to divide the software into parts. As you can see in the image above, the View knows the ViewModel interface. But the ViewModel knows nothing about the View. The same is true for the ViewModel, it knows about the Model interface. But the Model knows nothing about the ViewModel. Changing the View do not affect the ViewModel or the Model.

Read More »