Android Architecture
Android Architecture
Android is built in layers, like a cake, where each layer has a specific role. Here’s how it works:
The core of Android, managing hardware like Wi-Fi, Bluetooth, cameras, and memory.
It also handles security, power management, and communication between software and hardware.
It helps Android talk to the camera, sensors, and other hardware parts without knowing how they work
internally.
Libraries (Pre-built tools): Help with graphics, databases, and media playback (like watching videos or
playing music).
Android Runtime (ART): Runs Android apps efficiently and improves performance.
Includes systems for managing apps, notifications, permissions, location, and UI elements (buttons, text
fields, etc.).
The top layer where you interact with apps like WhatsApp, YouTube, and Camera.
Each layer plays a role in making Android fast, secure, and user-friendly.
1. System Requirements
Before installing Android Studio, ensure your system meets these minimum requirements:
Additional Requirements:
Open a web browser and go to the official Android Studio download page:
➡ https://developer.android.com/studio
4. Initial Configuration
After installation, Android Studio will launch automatically. If not, open it from the Start menu.
Step 2: Setup Wizard
Android SDK
Emulator
5. Verify Installation
Go to File > Settings > Appearance & Behavior > System Settings > Android SDK.
Click Run (Green Play Button) to test your app on an emulator or a connected device.
Slow Performance: Use an SSD and allocate more RAM to the emulator.
Intent in Android
An Intent in Android is a messaging object used to communicate between different components
of an application, such as activities, services, and broadcast receivers. It allows you to start new
activities, send data, trigger system actions, or communicate between applications.
Use case: When you know exactly which activity or component to open.
Example:
Downloading a file.
🔹 You clearly mention the target activity (SecondActivity.class), so Android knows where to go.
Use case: When you want to perform an action (like opening a webpage or sending an email) but
don’t specify the app.
🔹 Think of it like asking Google Maps for "restaurants near me" and letting it show options.
Example:
Opening a webpage.
intent.setData(Uri.parse("https://www.google.com"));
startActivity(intent);
🔹 Android will show a list of browsers to choose from, instead of a specific one.
It helps create flexible and dynamic UIs, especially for different screen sizes.
📱 On small screens (phones) – One activity usually takes up the entire screen.
💻 On large screens (tablets) – Multiple Fragments can be shown at the same time.
✔ In a messaging app, the contacts list can be one Fragment, and the chat window another.
✔ On a phone, they appear on separate screens, but on a tablet, they appear side by side.
Fragment Lifecycle
Method Description
Introduction
In Android, listening for UI notifications means setting up components to detect and respond to
user interactions, such as button clicks, menu selections, or key presses. This allows apps to react
dynamically to user actions.
Levels of UI Notifications
Activity Level – Detects user actions that affect the entire screen.
View Level – Detects interactions with specific elements like buttons or text fields.
At the activity level, we can override certain methods to respond to key presses or menu
selections:
View-level notifications occur when users interact with specific UI elements like buttons or input
fields. To handle these, we register event listeners.