Android Basics I — First App, Layouts, Views
Your first Android app in Android Studio. Learn the three main layout systems — LinearLayout, RelativeLayout, ConstraintLayout — by building the same Calculator UI three ways.
Key concepts
- Android Studio project structure
- Emulator vs physical device
- View, ViewGroup, id, findViewById
- LinearLayout & layout_weight
- RelativeLayout basics
- ConstraintLayout & constraints
Lectures in this day
- 01
Intro to Android
An Android app is made of a few kinds of files. Layouts (XML) describe what a screen looks like. Activities (Kotlin classes) run each screen. The Manifest lists the app's screens and permissions. Gradle is the tool that packs everything into an APK/AAB — the file the phone installs.
Real life · Opening a shop: the Manifest is your permit, layouts are the shelves, Activities are the salespeople, and images/strings are the stock.Practice · 3 quick questions
Q1.Android apps are typically written in…
Q2.The IDE recommended is…
Q3.A screen in Android is called…
Pick one answer per question. - 02
Run Your First App
In Android Studio pick 'Empty Views Activity', keep the defaults, wait for Gradle to finish, then press Run. Choose an emulator (a fake phone) or a real phone plugged in with USB (developer mode on). Your first app is 'Hello World'.
Real life · Plugging in a new toy for the first time — most of the wait is the first boot. After that it just works.bash# terminal sanity check (optional) adb devices # is your phone connected? ./gradlew installDebug # build + install without the IDEPractice · 3 quick questions
Q1.To run on a real phone you enable…
Q2.An emulator is…
Q3.The green 'Run' button does what?
Pick one answer per question. - 03
User Interaction (change text programmatically)
Every view (Button, TextView) can get an id in the layout, like `android:id="@+id/label"`. In Kotlin, `findViewById` finds that view so you can change it. A click listener runs your code when someone taps the button.
Real life · A doorbell with a sign above it. The wire (id) connects the button to the little machine that changes the sign.kotlinclass MainActivity : AppCompatActivity() { override fun onCreate(s: Bundle?) { super.onCreate(s) setContentView(R.layout.activity_main) 0