← Back to Tutorials Chapter 1

Getting Started with Android Development

What is Android?

Android is an open-source mobile operating system based on the Linux kernel. Developed by Google, it powers billions of devices worldwide — phones, tablets, wearables, TVs, and even cars.

Key Fact: Android has over 3 billion active devices globally, making it the most widely used mobile operating system.

Why Develop for Android?

Android Architecture

Android layered architecture

Android's architecture consists of several layers:

  1. Linux Kernel: The core OS layer providing drivers, memory management, and security.
  2. Hardware Abstraction Layer (HAL): Interfaces between hardware and the framework.
  3. Android Runtime (ART): Runs apps using ahead-of-time (AOT) compilation.
  4. Native C/C++ Libraries: OpenGL, WebKit, SQLite, etc.
  5. Application Framework: Java/Kotlin APIs for building apps.
  6. System Apps: Built-in applications like Phone, Contacts, Browser.

Application Components

Activity Lifecycle

Android Activity lifecycle stages

An Activity goes through several states:

Hello World App (Kotlin)

// MainActivity.kt
package com.example.hello

import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.TextView
import android.widget.Button

class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val greetingText: TextView = findViewById(R.id.greetingText)
        val clickMeButton: Button = findViewById(R.id.clickMeButton)

        clickMeButton.setOnClickListener {
            greetingText.text = "Hello, Android!"
        }
    }
}
<!-- activity_main.xml -->
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <TextView
        android:id="@+id/greetingText"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Welcome!"
        app:layout_constraintCenter="parent" />

    <Button
        android:id="@+id/clickMeButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Click Me"
        app:layout_constraintBeneath="@id/greetingText" />
</androidx.constraintlayout.widget.ConstraintLayout>
Exercise: Create a new Android project in Android Studio with an Empty Activity. Run it on the emulator, then modify the layout to include two TextViews and a Button that changes the second TextView's text when clicked.