mobile5 min read

Android Tutorial: Learn App Development from Scratch (2026)

Android Tutorial: Learn App Development from Scratch (2026)

Published:  |  Category: Mobile  |  Reading time: ~15 min
Android Tutorial: Learn App Development from Scratch (2026)

My first Android app was a flashlight toggle with a single button. It had a memory leak, crashed on orientation change, and the UI looked terrible on tablets. I learned the hard way that Android development is not just about writing Java or Kotlin — it is about understanding the lifecycle, configuration changes, and the fragmentation of screen sizes, API levels, and manufacturers. This tutorial walks through everything I wish I had known starting out, from setting up Android Studio to publishing on Play Store, with the practices that saved me from the most common pitfalls.

Android Studio and Project Setup

Android Studio, built on IntelliJ IDEA, is the official IDE. Download it from developer.android.com, install the Android SDK command-line tools, and accept the licenses. When you create a new project, choose a template — Empty Views Activity for traditional XML layouts, or Empty Compose Activity for Jetpack Compose. The project structure includes app/src/main/java/ for source files, res/ for resources (layouts, drawables, strings), and AndroidManifest.xml for app metadata. The build system is Gradle with Kotlin DSL becoming standard. Set compileSdk to the latest stable API level and minSdk based on your target audience.

plugins { id 'com.android.application' id 'org.jetbrains.kotlin.android' }
android { namespace 'com.example.myapp' compileSdk 35 defaultConfig { minSdk 24 } }

Activities and the Lifecycle

An Activity is a single, focused screen in Android. Its lifecycle — onCreate, onStart, onResume, onPause, onStop, onDestroy — governs how your app behaves when the user rotates the device, receives a phone call, or switches apps. The most common mistake beginners make is assuming the Activity lives forever. When the device rotates, Android destroys and recreates the Activity by default. Save transient state in onSaveInstanceState and restore it in onCreate. For persistent data, use ViewModel, which survives configuration changes.

override fun onCreate(savedInstanceState: Bundle?) {
  super.onCreate(savedInstanceState)
  setContentView(R.layout.activity_main)
  if (savedInstanceState != null) restoreState(savedInstanceState)
}

Layouts and UI Components

Android offers two UI toolkits: the legacy XML-based View system and Jetpack Compose. In the View system, you define layouts in XML using LinearLayout, RelativeLayout, ConstraintLayout, and FrameLayout. ConstraintLayout is the most flexible — it uses constraints to position widgets relative to each other and avoids nested layouts that hurt performance. Common widgets include TextView, Button, ImageView, RecyclerView, and EditText. Material Design Components give you polished implementations of cards, bottom navigation, floating action buttons, and snackbars with minimal effort.


  

Intents and Screen Navigation

Intents are Android's mechanism for navigating between screens and communicating between apps. An explicit Intent starts a specific Activity within your app — you pass the current context and the target class. An implicit Intent asks the system to find an app that can handle an action, like opening a URL or taking a photo. Use Intent.putExtra to pass primitive data, or serialize complex objects with Parcelable (faster than Serializable). For modern navigation, the Navigation Component with a nav graph XML gives you type-safe argument passing, deep linking, and proper back stack management.

val intent = Intent(this, DetailActivity::class.java)
intent.putExtra("item_id", 42)
startActivity(intent)

Data Persistence with Room and SQLite

Android provides several storage options. SharedPreferences stores key-value pairs for simple settings. For structured data, Room is the recommended abstraction over SQLite. Room generates boilerplate for creating databases, defining entities, and writing DAOs — all with compile-time SQL verification. Define an Entity as a data class annotated with @Entity, create a DAO interface with @Insert, @Query, @Update, and @Delete methods, and build a RoomDatabase subclass. Room integrates seamlessly with LiveData or Flow for reactive queries that update the UI automatically.

@Entity data class User(@PrimaryKey val id: Int, val name: String)
@Dao interface UserDao { @Query("SELECT * FROM user") fun getAll(): List }

Publishing Your App on Google Play

Before publishing, generate a signed App Bundle (AAB) using Android Studio's Build > Generate Signed Bundle menu. You need a keystore file, which you should back up securely — losing it means you cannot update your app. Upload the AAB to Google Play Console, fill out the store listing with screenshots, a description, and category, set pricing and distribution, and review the content rating questionnaire. Google now requires apps to target API 33+ (Android 13) and support 64-bit architectures. After submission, your app goes through review, which typically takes a few hours to a couple of days.

// In build.gradle
signingConfigs { release { storeFile file('keystore.jks') storePassword '...' } }

Frequently Asked Questions

What is the difference between an Activity and a Fragment?

An Activity is a full-screen entry point managed by the system. A Fragment is a reusable portion of the UI within an Activity, with its own lifecycle. Fragments are useful for tablet layouts and tabbed interfaces where you need to swap parts of the screen.

Do I need to learn Java or Kotlin for Android?

Kotlin is now Google's preferred language. It is more concise, null-safe, and fully interoperable with Java. New projects should use Kotlin. You only need Java for maintaining legacy codebases or using certain older libraries.

How do I handle different screen sizes?

Use ConstraintLayout with relative constraints, avoid hardcoded dp values, and provide alternative resources in res/layout-sw600dp (tablets) and res/values-w820dp. Test on multiple emulator configurations and use the Android Studio Layout Validation tool.

Why does my app crash on orientation change?

Orientation change destroys and recreates the Activity. Move data loading to a ViewModel, which survives configuration changes. Also check that you are not holding references to the old Activity context in background threads or callbacks.

Originally published on Ayodhyyya. Last updated June 1, 2026.