Creating menus in android applications

Creating menu content This specific menu is displayed in an assembly Where are the menus? For each menu, it is necessary to define the items that are in it. It is defined in XML format in a file located in a specific folder named “menu” (located in the “res” folder). We generate this file by … Read more

Working with SQLite database in Android with the help of Room library

Introduction Room is a library recommended by Google as one of the components of the so-called. “Android Architecture Components” approach. Room is a wrapper around the SQLite database and is an abstraction layer that facilitates working with the database. The Room library takes over most of the responsibilities so that now we can create tables … Read more

LiveData & MVVM

LiveData class LiveData

LiveData is an abstract class called observable data holder in charge of keeping information about the data and notifying all interested observers if changes occur. LiveData is actually just an Abstract Class. So it can’t be used as itself. The most important feature of LiveData is that it is aware of … Read more

Introduction to MVVM architecture

MVVM pattern MVVM (Model-View-ViewModel) is a pattern that separates an application into multiple components so that each component has its own specific responsibilities. When using the MVVM pattern, the “code” of the application is separated into three parts: View, ViewModel and Model, this architecture is recommended by Google as one of the best ways to … Read more

Populating a ViewPager using a PagerAdapter

What is ViewPager? ViewPager is a Layout Manager that allows the user to move through pages of data with movements to the left or right, while when changing pages, a built-in animation is executed. Most often, those pages with data are fragments, although they can be something else, for example. images that slide… ViewPager is … Read more

Adapter for RecyclerView

Introduction The adapter is a bridge between the data source (Array object, List object…) and the user interface. The role of the adapter object (implements the Adapter interface) is to read data from various data sources, and based on them fills View objects with members of a ViewGroup. So far we have used ListView, but … Read more

Custom ArrayAdapter in Android

Introduction In the basic version of the adapter, only one String data is used, which is placed in one of the predefined android layouts with one TextView. Custom adapter differs from “ordinary” in that one list element is presented with more data and it is necessary to define a “more complex layout” that would accept … Read more

ArrayAdapter (basic android adapter)

Introduction Adapter is a bridge between the data source (Array object, List object…) and the user interface. The role of the adapter object (implements the Adapter interface) is to read data from different data sources, and based on them fill View objects members of a ViewGroup. ViewGroup: ListView, RecyclerView, GridView, Spinner, Gallery whose contents are … Read more

Converting an XML resource to a View object (“Layout Inflating”)

Introduction “Layout inflation” is a term used to describe the process by which an XML resource is parsed and converted into a View object. The activity has its own method setContentView() with which it inflates its root view: Example

But we can convert other layouts into a View object (thereby enabling the layout elements … Read more