Welcome
Android Application Development


Time: 09:00 AM - 04:00 PM
Location: Anderson 201

Table of Contents

Date Time Topic Notes
June 2 9 AM – 4 PM Course Intro, Android Studio Setup, Interface Walkthrough Lunch break: 12–1 PM
June 3 9 AM – 4 PM Android Project Structure, Calculator App
June 4 9 AM – 4 PM Activities, Intents, UI Design with Layouts and Widgets
June 5 9 AM – 4 PM Intro to Android Sensors, Implementing Sensors
June 6 9 AM – 4 PM Advanced Sensors, Practical App Building
June 9 9 AM – 4 PM SQLite Introduction, Data Storage in App
June 10 9 AM – 4 PM Shared Preferences, Data Persistence Hands-on saving and retrieving data
June 11 9 AM – 4 PM User Feedback, Notifications, Debugging Please visit our course
June 12 9 AM – 4 PM Final Project, App Presentation and Closing Family welcome at 3 PM

Course Intro, Android Studio Setup, Interface Walkthrough

Mobile OS History: Android vs. iOS

Year Android Milestone iOS Milestone
2007 Android Inc. acquired by Google (2005), platform announced iPhone and iOS 1.0 launched (no App Store)
2008 First Android phone: HTC Dream (T-Mobile G1) App Store introduced with iOS 2.0
2011 Android becomes most used mobile OS iOS 5 introduces iCloud and iMessage
2014 Material Design introduced with Android 5.0 Lollipop iOS 8 supports third-party keyboards and widgets
2017 Android 8.0 Oreo with notification dots and better battery iOS 11 brings ARKit and redesigned App Store
2020 Android 11: chat bubbles, screen recording, privacy iOS 14 introduces widgets on the home screen
2023 Android 14 focuses on personalization and foldables iOS 17 adds StandBy Mode and Contact Posters

Android vs. iOS: Key Numbers (2024)

Metric Android iOS
Global Market Share ~70% ~28%
Total Apps (Store) ~3.5 million (Google Play) ~1.8 million (App Store)
Active Devices ~3.9 billion ~1.5 billion
Top Manufacturer Samsung Apple
Avg. App Revenue per User $0.47 $1.64
OS Updates Support 2–3 years (varies) 5+ years

Top 3 Apps (2024)

Rank Google Play Store Apple App Store
1 TikTok TikTok
2 Instagram Instagram
3 Facebook CapCut

*Based on total global downloads (2024)

Top Tools for Android and iOS Development

  • Android Studio – Official IDE for Android development
  • Xcode – Official IDE for iOS/macOS development
  • Flutter – Cross-platform UI toolkit by Google
  • React Native – JavaScript framework for building native apps
  • Firebase – Backend services for real-time apps
  • CocoaPods – Dependency manager for iOS projects
  • Fastlane – Automation tool for app releases

Links open in new tabs. Most tools support both platforms or offer platform-specific advantages.

Design
Function

Regular vs Android Software

Aspect Regular Software Android Software
Power Usage Typically unconstrained Battery-sensitive
Offline Use Often requires constant network Must handle offline scenarios
CPU & Memory Can assume high performance Must optimize for low-resource devices
Storage More disk space available Limited internal storage
Deployment Installed on servers/desktops Distributed via app stores
UI/UX Designed for large screens & keyboard Touch-focused, small screens

Android Architecture

Android Architecture Diagram

Image source: GeeksforGeeks

Android Project Structure, Calculator

Android Project Structure

  • src/main/java/ - Kotlin files
  • src/main/res/layout/ - XML UI files
  • AndroidManifest.xml - Declare Activities

One activity + layout for calculator app.

Layout XML (activity_main.xml)


    <LinearLayout
        android:orientation="vertical"
        android:padding="16dp"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <EditText android:id="@+id/etNumber1" ... />
        <EditText android:id="@+id/etNumber2" ... />
        <Button android:id="@+id/btnAdd" ... />
        <TextView android:id="@+id/tvResult" ... />
    </LinearLayout>
                    

Where to Store Layout

Save XML at:


    app/src/main/res/layout/activity_main.xml
                    

Used by MainActivity via setContentView().

MainActivity.kt Location

Path:


    app/src/main/java/com/example/calculator/MainActivity.kt
                    

Basic activity code skeleton:



    class MainActivity : AppCompatActivity() {
        override fun onCreate(savedInstanceState: Bundle?) {
            super.onCreate(savedInstanceState)
            setContentView(R.layout.activity_main)
        }
    }
                    

onCreate() & setContentView()

onCreate() // : Activity start point
setContentView() // : Load UI from XML.

Accessing Views


    val et1 = findViewById<EditText>(R.id.etNumber1)
    val et2 = findViewById<EditText>(R.id.etNumber2)
    val btn = findViewById<Button>(R.id.btnAdd)
    val tv = findViewById<TextView>(R.id.tvResult)
                    

Use these to read inputs and update output.

Button Click Listener


    btn.setOnClickListener {
    // code when clicked
    }
      

Put calculation logic here.

Read Input Values


    val num1 = et1.text.toString().toDoubleOrNull() ?: 0.0
    val num2 = et2.text.toString().toDoubleOrNull() ?: 0.0
      

Safe conversion with default 0.0

Calculate & Show Result


    val result = num1 + num2
    tv.text = "Result: $result"
      
override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val et1 = findViewById<EditText>(R.id.etNumber1)
        val et2 = findViewById<EditText>(R.id.etNumber2)
        val btn = findViewById<Button>(R.id.btnAdd)
        val tv = findViewById<TextView>(R.id.tvResult)
        btn.setOnClickListener {
            val num1 = et1.text.toString().toDoubleOrNull() ?: 0.0
            val num2 = et2.text.toString().toDoubleOrNull() ?: 0.0
            val result = num1 + num2
            tv.text = "Result: $result"
        }
    }
<LinearLayout
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android">
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Vertical Layout Example" />
    <LinearLayout
        android:orientation="horizontal"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingTop="16dp">
        <Button
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="Button 1" />
        <Button
            android:layout_width="0dp"
            android:layout_weight="1"
            android:layout_height="wrap_content"
            android:text="Button 2" />
    </LinearLayout>
</LinearLayout>
Property Description Example XML
background Sets background color or drawable android:background="#FF0000"
textSize Sets text font size android:textSize="18sp"
textColor Sets text color android:textColor="#333333"
padding Sets padding inside view android:padding="16dp"
layout_width Width of the view android:layout_width="match_parent"
layout_height Height of the view android:layout_height="wrap_content"
layout_margin Margin outside the view android:layout_margin="8dp"
gravity Aligns content inside the view android:gravity="center"
layout_gravity Aligns view inside parent layout android:layout_gravity="center"
visibility Shows or hides the view android:visibility="gone"

Common Kotlin Syntax in Android

Concept Description Example
Variable Declaration Immutable and mutable vars val name: String = "Solomon"
var age: Int = 30
Null Safety Nullable types & safe calls var s: String? = null
println(s?.length ?: 0)
Function Named function with return fun add(a: Int, b: Int): Int { return a + b }
Single-Expression Function Short form function fun mul(a: Int, b: Int) = a * b
Class Class with properties class Person(val name: String, var age: Int)
Lambda Anonymous function btn.setOnClickListener { /* code */ }
Object Expression Anonymous class instance val listener = object : View.OnClickListener { ... }
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.app">
    <application
        android:allowBackup="true"
        android:label="@string/app_name"
        android:icon="@mipmap/ic_launcher"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>
Questions?