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

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

A fragment in the android framework

Introduction A fragment is a modular part of an activity, which has its own life cycle, receives its own input events, you can add or remove it while the activity is running. A fragment unifies the View and logic so that it can be easily reused within one or more different activities. There can be … Read more

An introduction to asynchronous operations and Android multithreading

What is Thread and multithreading? Thread is a series of instructions within a program that can be executed independently of other code. If the computer has multiple processors and an operating system that supports the so-called multithreading, it allows programmers to design programs whose threads can be executed simultaneously. Thread mechanisms “Looper” and “MessageQueue” are … Read more

Activity within the android operating system

What is android activity? Android applications are a collection of tasks, where each task has its own functionality. These functionalities can be divided into four Android components: Functionality Android class Example User interaction Activity Entering a note, playing a computer game A background process that runs for a long time even when the user is … Read more