Category: Uncategorized

ViewModel

MVVM’s ViewModel implementation in Android application. Architecture Components’ ViewModel What is ViewModel? ViewModel – it is a model of the view. The purpose of the ViewModel is to apply any business logic to the Model before exposing it to the View for consumption. This way the View is free of business logic. Its only purpose […]

Read more

Room example

Using Room in CryptoOracle In the Android application CryptoOracle the data is persisted in SQLite database. The reasons are two: The application can still work and show persisted data when there is no internet connection. The network traffic is reduced because requests are sent from the application only when the data is outdated and new […]

Read more

Integrating LiveData with Room

Room. Reactive queries Integrating LiveData with Room Room has great integration with LiveData. Results from SQL queries can be easily wrapped in LiveData container. This way LiveData can be observed in the UI. When the data is changed in the database, all active observers get notified and update the corresponding views. This saves time for […]

Read more

Designing REST API architecture

Designing REST API architecture The REST architecture consists of three layers. The architecture is shown in the picture below. The web layer is the top layer in the architecture. It is responsible for processing user queries and returning back responses to the user. These operations happen in the controllers. The web layer handles exceptions which […]

Read more

Repository in Android’s MVVM architecture

Repository in Android’s MVVM architecture What is Repository in Android’s MVVM architecture? Repository is a class which purpose is to provide a clean API for accessing data. What that means is that the Repository can gather data from different data sources(different REST APIs, cache, local database storage) and it provides this data to the rest […]

Read more

View in the MVVM architecture

View in the MVVM architecture What is View in the MVVM architecture? The View component in the MVVM architecture are the UI controllers – Activities and Fragments. They should be as free as possible from any business logic. Their role is to present the data, not to transform it. The view should contain only UI […]

Read more

LiveData

LiveData What is LiveData? LiveData is an observable data holder class. It is also lifecycle-aware, which means that it respects the lifecycle of the other app components, such as activities, fragments and services. It notifies only active observers, represented by the Observer class. Using LiveData has a lot of benefits, some of which are: Ensures […]

Read more

MVVM’s Model implementation in Android application. Room

MVVM’s Model implementation in Android application. Room What is Model in MVVM architecture? As we said in the previous article Model is the data in our application. These are classes representing objects that we persist in our database or that we get from network calls to services. It is another name for the domain objects. […]

Read more

MVVM and its implementation in Android

MVVM and its implementation in Android Why is it bad to write code without following an architecture? Writing application code before thinking about an architecture is a really bad idea. Android programming does not make a difference. Everybody who starts creating Android apps begins doing so without following a specific architecture. All the code concerning […]

Read more