All days
Day 07Module 4 · Architecture Components· 4–6 hrs
Architecture I — Fragments, Navigation Component, BMI Layout
Fragments are reusable UI pieces inside an Activity. Navigation Component makes moving between them safe and visual. Start the BMI Calculator project.
0% done
Key concepts
- Fragment lifecycle vs Activity lifecycle
- FragmentContainerView & NavHost
- Nav graph (res/navigation/nav_graph.xml)
- Actions and destinations
- Passing args via Bundle
Lectures in this day
- 01
Introduction to Architecture Components
Google gives us a set of ready-made tools called Jetpack. They solve problems every app has — screens (Navigation), data (Room), state (ViewModel), background work (WorkManager). Using them means less code AND fewer bugs.
Real life · Instead of forging your own nails at every building site, you buy them from a hardware store. Same purpose, way less pain.Practice · 3 quick questions
Q1.Architecture Components help with…
Q2.They live in package…
Q3.Main benefit?
Pick one answer per question. - 02
Fragment Overview
A Fragment is a small reusable piece of a screen, with its own life cycle. One Activity can hold several fragments (great for tablets), and Navigation swaps them in and out.
Real life · LEGO pieces that snap into a bigger board. The same piece can be reused in different builds.kotlinclass InputFragment : Fragment(R.layout.fragment_input) { 0