Saturday, August 7, 2021

What is the Core Building Blocks of Android?

The core building blocks or fundamental components of android are activities, views, intents, services, content providers, fragments and AndroidManifest.

Activity:

An activity is a class that represents a single screen in application.

View:

A view is the User Interface element such as button, label, text field etc. Anything that you see is a view.

Intent:

Intent is used to invoke components. It is mainly used to:

=> Start the service

=> Launch an activity

=> Display a web page

=> Display a list of contacts

=> Broadcast a message

=> Dial a phone call etc.

For Example:

    Intent intent=new Intent(Intent.ACTION_VIEW);  
    intent.setData(Uri.parse("https://moonyincoding.blogspot.com"));  
    startActivity(intent);   

Service:

Service is a background process that can run for a long time. 

Content Provider:

Content Providers are used to share data between the applications. 

Fragment:

Fragments are like parts of activity. An activity can display one or more fragments on the screen at the same time.

AndroidManifest

It contains informations about activities, content providers, permissions etc.

Friday, August 6, 2021

What is the Android Architecture?

 Well, Android Architecture is categorized into five part.

    1. Linux kernel
    2. Native Libraries (Middleware),
    3. Android Runtime
    4. Application Framework
    5. Applications

You can see the picture shown below.

Linux kernel:

It is the heart of android architecture that exists at the root of android architecture. Linux kernel is responsible for device drivers, power management, memory management, device management and resource access.

Native Libraries:

On the top of Linux kernel, their are Native libraries such as Web-Kit, Open-GL, Free-Type, SQLite, Media, C runtime library (libc) etc.

The Web-Kit library is responsible for browser support, SQLite is for database, Free-Type for font support, Media for playing and recording audio and video formats.

Android Runtime:

In android runtime, there are core libraries and DVM (Dalvik Virtual Machine) which is responsible to run android application. DVM is like JVM but it is optimized for mobile devices. It consumes less memory and provides fast performance.

Android Framework:

On the top of Native libraries and android runtime, there is android framework. Android framework includes Android API's such as UI (User Interface), telephony, resources, locations, Content Providers (data) and package managers. It provides a lot of classes and interfaces for android application development.

Applications:

On the top of android framework, there are applications. All applications such as home, contact, settings, games, browsers are using android framework that uses android runtime and libraries. Android runtime and native libraries are using Linux Kernal.

 

A Simple Data Binding Example

  Step-1: Enable data binding to android project ADD below line to your app level build.gradle file. android {     buildFeatures {        ...