A Guide To AndroidX Part II: The Components

Start off the new year with a skill that continues to be relevant and is growing in demand exponentially. You can easily learn Android Development with the numerous resources available online which have been mentioned and linked on this blogpost (Part 2/3) to help you navigate the first phase of learning.


In this phase you’ll be learning about the basic concepts of Android and by the end of this phase, you’ll learn how to make a basic Android application.

In the second phase, we focus on some of the components that you should know before you start developing with AndroidX.

A report published by Statista notes mentions, “as of 2019, Android held a share of about 91 percent of the mobile operating system market in India.” The OS giant also dominates the global market. This skill not only lends you infinite opportunities but also flexibility to have greater agency over your day.

Architecture-Based

Here we cover the low-level details of an android application and an android application’s structure.

The architecture of Android OS – The Linux Kernel forms the foundation of the android OS. It’s an open source and free Kernel. The Android OS architecture helps with app-permissions and package managers etc.

Android App’s Structure – In Android OS, a project has everything that outlines your workspace for the application. It contains everything – from source code, assets, test code to build configurations. It defines the significance and usage of each package in an Android application.

Significance of Manifest file – The manifest file lays out crucial information about the app. It is at the root of the project source. It declares a variety of things including components of the application, activities, services, broadcast receivers etc. Every component has to define the name of the Kotlin or Java class it uses. It should also lay out the permissions required by the application to access certain protected components. Lastly, the manifest file defines the hardware and software components used by the app.

App Components

At a high level, Android Application Development can be summed up into these 4 components. Each component represents an entry point that the system or a user can use to enter the app. They are fundamental to Android Development.

Activity

An activity is the starting point of engaging with the user which has one screen and is backed by a strong user interface. The activities operate together to make a cohesive application that is user-friendly.

Services

A service on the other hand does not have a user interface and operates in the background to materialise long-running operations and remote processes

Broadcast Receivers

Broadcast receivers allow the app to engage with system-wide broadcast announcements. It allows the system to interact outside of a regular user flow by delivering events.

Content Providers

Content providers manage app data that is private and cannot be shared. This data can be stored in SQLite database, file system, web or any other storage site.

Learn more about app components here.

Code Components

Android components are pieces of code that have well-defined life cycles. They are the core components for android.

Activities

They represent a single screen. (Have a look at types of sample activities provided by Android Studio, along with the lifecycle of activity)

Views

They are the UI components like buttons, text fields, banners, etc.

Fragments

As evidenced by their name, Fragments are segments of activities. They include parts of an app’s UI that can be reused.

Intents are used to call on actions or components of the app like starting the app, launching activities, displaying elements or webpages, etc

Services

They are background systems or processes that run for a long period of time. They can be local (accessed from within the app) or remote (accessed remotely from other apps running on the device).

Content Providers

They share data between apps.

There are also other important components like AndroidManifest.xml that contains information about all the aforementioned components and permissions. Android Virtual Device or AVD is another element that allows you to test your app without the need for devices such as mobiles.

UI Components

Android’s UI Controls or components are what help you design the User Interface for the users to interact with your application. Android provides you with an assortment of UI controls (also called Input Controls) for your app.

Views

There are 6 main types of views in Android.

  1. TextView displays a formatted text label,
  2. ImageView displays an image resource,
  3. Button can be clicked to perform an action,
  4. ImageButton displays a clickable image,
  5. EditText is an editable text field for user input,
  6. ListView is a scrollable list of items containing other views.

Here’s a useful list for you to learn more.

Layouts

A layout specifies the structure of the user interface in an app, for example in an activity. In a layout, all elements are made using a hierarchical combination of View and ViewGroup objects.


We have listed the View types in the previous point. The View is something that the user can see, engage and interact with.

A ViewGroup a group of Views. Essentially, when you batch a group of Views (TextView, Image View, Button, etc) together.


These Views and ViewGroups are constructed in a pre-decided hierarchy to create a UI layout.

UI Events in Android

These are the actions that should be handled in the UI layer. They are handled by either the UI or by something called the ViewModel (it acquires and stores the information necessary for an action or fragment).

Styles

Styles and themes allow one to demarcate the specifications of the app design from the structure and behavior of the UI. It has similarities to stylesheets in web design. A style is a bundle of attributes that outline the appearance and structure for a single View. It ascribes attributes like font type, color, size, background shade etc. A common use case of styles is handling the appearance of your elements in the light and dark modes.

Design Guidelines

Your app should be an extension of your platform and represent your brand in a cohesive manner. Having predefined design guidelines also help Android users align with your goals. Not only should the material aspect of your design like navigation and visual patterns align with the platform but they should outline the best practices to enhance the performance, security and compatibility of your app.

Project 1 – (Estimated Time ➝ not more than 4 hours)

Make a simple android application using a single activity and fragment, containing a floating action button that’ll increase the count of text displayed in the middle of the screen.

Figma Link: Android Module Project 1

Share this post:
Facebook
Twitter
LinkedIn
WhatsApp

From the same category: