Android Developer Master Cheat Sheet & Quick Reference

A developer cheat sheet designed for instant desktop reference, university pre-exam revision, and interview preparation. Covers essential lifecycle sequences, Jetpack Compose syntax, Coroutines dispatchers, Room annotations, and essential ADB terminal commands.

1. Activity Lifecycle Rapid Summary

Event Callback Sequence
App Launched onCreate() -> onStart() -> onResume() (Foreground Active)
User Presses Home onPause() -> onStop() (Hidden in background)
User Re-opens App onRestart() -> onStart() -> onResume()
Screen Rotation onPause() -> onStop() -> onDestroy() -> onCreate() -> onStart() -> onResume()

2. Jetpack Compose Cheat Sheet

// State Declaration
var count by remember { mutableStateOf(0) }
var text by rememberSaveable { mutableStateOf("") } // Survives rotation

// Layout Primitives
Column(modifier = Modifier.fillMaxSize().padding(16.dp)) { ... }
Row(horizontalArrangement = Arrangement.SpaceBetween, verticalAlignment = Alignment.CenterVertically) { ... }
Box(contentAlignment = Alignment.Center) { ... }

// High-Performance Recycled Lists
LazyColumn(verticalArrangement = Arrangement.spacedBy(8.dp)) {
    items(myList, key = { it.id }) { item ->
        Text(item.name)
    }
}

// Observing StateFlow in Compose
val state by viewModel.uiState.collectAsStateWithLifecycle()

3. Kotlin Coroutines & Flow Quick Reference

// Thread Dispatchers
withContext(Dispatchers.Main)    // UI Updates
withContext(Dispatchers.IO)      // Network, SQLite, File I/O
withContext(Dispatchers.Default) // CPU-heavy parsing, sorting

// ViewModel Coroutine Launch
viewModelScope.launch {
    try {
        val result = repository.fetchData()
    } catch (e: Exception) {
        // Handle error
    }
}

// Concurrent Parallel Execution
val data1 = async { fetchA() }
val data2 = async { fetchB() }
val combined = data1.await() + data2.await()

4. Room Database Annotations Reference

Annotation Usage
@Entity(tableName = "items") Marks a Kotlin data class as a SQLite table
@PrimaryKey(autoGenerate = true) Defines the unique auto-incrementing primary key ID
@ColumnInfo(name = "custom_col") Overrides the SQLite table column name
@Dao Marks an interface containing SQL query methods
@Query("SELECT * FROM items") Compile-time verified custom SQL query string
@Insert(onConflict = REPLACE) Inserts or replaces rows on unique constraint collision

5. Essential ADB (Android Debug Bridge) Terminal Commands

# List all connected physical devices and emulators
adb devices

# Install an APK file onto the connected device
adb install -r app-release.apk

# Uninstall an application
adb uninstall com.veewom.app

# View live filtered Logcat crash output
adb logcat *:E

# Launch an Activity directly via Intent
adb shell am start -n com.veewom.app/.MainActivity

# Trigger an Android App Link deep link
adb shell am start -W -a android.intent.action.VIEW -d "https://veewom.com/android/42" com.veewom.app

# Take a screenshot and pull to your PC
adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png .

Frequently Asked Questions (FAQ) - Student & Interview Review

Q1. Where is the ADB command located on my computer?

ADB is located in your Android SDK installation directory under `platform-tools/` (e.g., `C:\Users\\AppData\Local\Android\Sdk\platform-tools`). Add this folder to your operating system's PATH environment variable to execute `adb` from any terminal.

Q2. What is the fastest way to clear app data from ADB?

Execute `adb shell pm clear com.veewom.app`. This resets all app permissions, deletes local Room databases, and purges DataStore preferences, simulating a fresh first-time installation.

Q3. How can I inspect the database on a running Android device?

In Android Studio, open `View > Tool Windows > App Inspection > Database Inspector`. You can view live SQLite tables, run custom SQL queries, and see table mutations happen in real-time while using the app.

Explore Related Android Development Classes & Next Steps

Broaden your foundational and advanced Android application development skills across our curriculum:

Android Tutorial Complete Syllabus

Return to the master curriculum overview and 8 learning modules.

130+ Technical Interview Q&A

Comprehensive technical interview questions and answers.

BCA & University Viva-Voce Guide

University examination guide and project viva preparation.

35+ Hands-On Practice Projects

Put cheat sheet snippets into action across 35+ real projects.

Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Reddit

You may also like this!