What Is Android?
What Is Android?
Android is an open-source, Linux-based operating system mainly designed for touchscreen mobile
devices like smartphones and tablets. It was developed by the Open Handset Alliance, which is led
by Google. Android allows developers to build applications that run on a wide variety of devices
using the same code base.
Key Features:
• Google Services: Deep integration with Google tools like Gmail, Maps, YouTube.
• Device Flexibility: Can work as a router, install custom ROMs, support 2D/3D graphics,
and runs on TVs, tablets, and set-top boxes too.
2. Android Architecture
1. Linux Kernel
2. Native Libraries
◦ Examples:
4. Application Framework
◦ Includes services like Activity Manager, Resource Manager, and Noti cation
Manager.
5. Applications
An Activity is a single screen that the user interacts with. It resembles a window in desktop
applications.
Lifecycle Methods:
• onCreate(): Called when the activity is rst created. UI setup happens here.
• onPause(): Called when the activity loses focus (e.g., a popup appears).
<LinearLayout android:orientation="vertical">
</LinearLayout>
• Table Layout: TableLayout is a view that groups views into rows and columns.
• Absolute Layout: AbsoluteLayout enables you to specify the exact location of its children.
• Frame Layout :The FrameLayout is a placeholder on screen that you can use to display a
single view.
• List View : ListView is a view group that displays a list of scrollable items.
Layout Attributes
• android:id : This is the ID which uniquely identi es the view.
• android:layout_marginTop : This is the extra space on the top side of the layout.
• android:layout_marginBottom : This is the extra space on the bottom side of the layout.
• android:layout_marginLeft : This is the extra space on the left side of the layout.
• android:layout_marginRight : This is the extra space on the right side of the layout.
• android:layout_weight : This speci es how much of the extra space in the layout should be
allocated
• to the View.
5. Controllers
Controllers handle user inputs, process them, and update the UI or data accordingly.
Role in Android:
• Handles events like button clicks, validates input, and updates UI.
Controller: Handles user actions, processes input, and updates the model or the view
accordingly.
1. Role of Controller
It manages user interactions and updates both the view and model.
Separates concerns: UI code, data logic, and input handling are split.
Makes scaling the app easier (e.g., adding new features or views)
6. Application Components
Additional Components
Fragments : Represents a portion of user interface in an Activity.
7. Directives
In XML Layouts:
• Types of Services:
fi
fi
fi
fi
fi
◦ Foreground: With visible noti cation
9. R.java File
10. strings.xml
<resources>
<string name="hello_world">Hello World!</string>
</resources>