Project Structure & Intent
Project Structure & Intent
This is the "Identity Card" or the "Blueprint" of your application. The Android Operating
System reads this file first to understand what the app contains.
Key Points:
o It defines essential app metadata, such as the app's name, launcher icon, and main
theme.
o Every single Activity (screen) created in the app must be registered here;
otherwise, it will not open.
o Permissions: If the app needs to access hardware or external data (like the
Internet, Camera, or Gallery), the request must be declared in this file.
Kotlin Folder:
Concept:
This folder acts as the "Brain" of your application. It houses all the logical and functional code.
Key Points:
[Link]:
This is the default Kotlin file where the execution of your app begins. It is backend logic,
such as what happens when a button is clicked or how data is processed. It’s entirely
controlled by the files inside this directory.
.XML Folder:
Concept:
This is the visual and presentation layer of the app. Anything related to the user interface (UI)
and design lives here.
Main Sub-folders:
layout/: Contains XML files (e.g., activity_main.xml). This is where the Screen
Design takes place using UI components like buttons, text fields, and images.
drawable/: Stores all graphic assets, such as images, vector assets, and custom
shapes/icons.
values/: Contains configuration files like [Link] (for app text), [Link] (for
color palettes), and themes to keep the code clean and reusable.
Feature Android Emulator (Virtual Device) Real Device (Physical Android Phone)
Ideal for testing the app on different Crucial for testing real-world hardware
Testing Use-
screen sizes and Android versions features like the Camera, GPS, hardware
case
(e.g., Pixel, Samsung layouts). sensors, and battery consumption.
Lecture Tip: Students with 8GB of RAM or less on their laptops to strictly use a Real
Device. This prevents Android Studio from freezing or lagging during development.
Concept:
Logcat is the "Black Box" or system log of Android Studio. While the app is running,
Logcat prints out everything happening in the background, including system messages and
explicit errors when an app crashes.
Explicit Intents
Concept:
Used to launch a specific component (usually a screen/Activity within your own app) by
explicitly naming the target class.
Analogy:
Sending a letter to someone by writing their exact home address. You know exactly who should
receive it.
Kotlin Example:
Kotlin
Important Note:
ProfileActivity::[Link] uses the .java extension because, even
though we write code in Kotlin, the underlying Android framework still
compiles down to communicate with Java bytecode. If they forget to add
::[Link] at the end, Android Studio will throw a compiler error.
Implicit Intents
Concept:
Used when you declare the action you want to perform, but you do not know which specific
application or component on the device will handle it. The Android system filters all installed
apps to find the best match.
Analogy:
Standing in a crowded room and shouting, "Is there a doctor here?" Anyone with a doctor's
qualification can step forward.
Opening a website link, taking a picture, or sharing text via external apps.
Kotlin Example:
Kotlin
Data is sent as a bundle of Key-Value pairs. The sender attaches the data using a unique "Key"
(a string identifier), and the receiver extracts the data using that exact same "Key".
Use the .putExtra() method on your intent instance before starting the activity.
Kotlin
Retrieve the data in the onCreate() method of the destination activity using the appropriate
type-specific getter method (getStringExtra, getIntExtra, etc.).
Kotlin
Kotlin
Opens the default phone dialer screen with a specific phone number pre-filled.
Note: ACTION_DIAL does not require runtime permissions because it only populates the dialer; it
does not make the actual call automatically.
Kotlin
Kotlin