r/JetpackComposeDev • • Oct 06 '25

Tips & Tricks Jetpack Compose Simple: Core Concepts Explained in Q&A

Thumbnail
gallery
9 Upvotes

A quick, easy-to-read breakdown of Jetpack Compose fundamentals - explained in a clear Q&A format.


r/JetpackComposeDev • • Sep 25 '25

News Android 16: Predictive Back Migration or Opt-Out Required

Post image
9 Upvotes

For apps targeting Android 16 (API level 36) or higher and running on Android 16+ devices, predictive back system animations (back-to-home, cross-task, cross-activity) are enabled by default.

Key changes: - onBackPressed() is no longer called - KeyEvent.KEYCODE_BACK is not dispatched

If your app intercepts the back event and you haven't migrated to predictive back yet, you need to:

  1. Migrate to the supported back navigation APIs

  2. Or temporarily opt out by setting the following in your AndroidManifest.xml:

<application
    android:enableOnBackInvokedCallback="false"
    ... >
</application>

(You can also set this per <activity> if needed)

Official docs: Predictive Back Navigation


r/JetpackComposeDev • • Sep 23 '25

Question How to store and load data from Room Database? [Simple App Example]

9 Upvotes

Original question

This is the solution I've found in researches from different sources, piece-by-piece, and taking the advise from the Good People here. My justification for posting this is:

  • Most of examples and help one founds in the internet are presented with Advanced Level concepts that confuses a beginner (as one myself). But if, for example, one desires to solve derivatives with effectiveness (using rules), one must first learn to solve it as limit (learning over optimization)

So here is my simple example, an app that can store user objects in the database and then retrieve them (update/delete not implemented yet). Minimal UI, no encryption, asynchronous or live data, no responsive modern UI/UX. I still don't understand routines, flows and view models, so I didn't use them

build.gradle.kts(Tutorial)

plugins{
    //copy-paste this bellow the others and sync the changes
    id("com.google.devtools.ksp") version "2.0.21-1.0.27" apply false
}

build.gradle.kts(Module)

plugins {
   //copy-paste this bellow the others
   id("com.google.devtools.ksp")
}

dependencies {
    //copy-paste this bellow the others and sync the changes
    val roomVersion = "2.8.0"
    implementation("androidx.room:room-runtime:${roomVersion}")
    ksp("androidx.room:room-compiler:$roomVersion")
}

User - has the class that represents the table

package com.example.tutorial.models

import androidx.room.PrimaryKey
import androidx.room.Entity

@Entity
data class User(
    u/PrimaryKey(autoGenerate = true)
    val id: Int = 0,
    val email: String?,
    val password: String?,
    val is_authenticated: Boolean = false
)

UserDao - has CRUD functions for the database

package com.example.tutorial.roomdb

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import androidx.room.Update
import com.example.tutorial.models.User

@Dao
interface UserDao {
    @Query("SELECT * FROM user WHERE id = :userId")
    fun getUserById(userId: Int): User?

    @Query("SELECT * FROM user")
    fun getUsers(): List<User>

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    fun insertUser(user: User)

    @Update
    fun updateUser(user: User)

    @Delete
    fun deleteUser(user: User)
}

UserDatabase - has the database code

package com.example.tutorial.roomdb

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import com.example.tutorial.models.User

@Database(entities = [User::class], version = 1)
abstract class UserDatabase : RoomDatabase() {
    abstract fun userDao(): UserDao
}

CreateUser - screen/page to create users

package com.example.tutorial.views

import androidx.compose.runtime.Composable
import androidx.room.Room
import com.example.tutorial.models.User
import com.example.tutorial.roomdb.UserDatabase
import androidx.compose.ui.platform.LocalContext

@Composable
fun CreateUsers(navController: NavHostController) {

    //...Declaring some variables, and some form to get user email and password

    //Database config(The thread function is to perform CRUD operations on the database in different thread - mandatory)
    val context = LocalContext.current
    val db = Room.databaseBuilder(context, UserDatabase::class.java,
        name = "userdb").allowMainThreadQueries().build()
    val userDao = db.userDao()

  //Storing user data
  val user = User(email = email, password = password2)
  userDao.insertUser(user)
}

UsersList - screen/page to load users from database

package com.example.tutorial.views

import androidx.compose.runtime.Composable
import androidx.room.Room
import com.example.tutorial.components.BodyBase
import com.example.tutorial.models.User
import com.example.tutorial.roomdb.UserDatabase

@Composable
fun UsersList(navController: NavHostController){

    //...Declaring some Variables

    //Database config(The thread function is to perform CRUD operations on the database in different thread - mandatory)
    val context = LocalContext.current
    val db = Room.databaseBuilder(context, UserDatabase::class.java,
        name = "userdb").allowMainThreadQueries().build()
    val userDao = db.userDao()

    //Retrieving users
    var usersList by remember { mutableStateOf(listOf<User>()) }
    usersList = userDao.getUsers()

    usersList.forEach { user ->
        Text(
            text = "Email: ${user.email}",
            fontSize = 18.sp,
            fontWeight = FontWeight.Bold,
            modifier = Modifier
                .fillMaxWidth().padding(12.dp)
        )
    }
}

P.S: this is a simple example, but not free of potential improvements. Also it's not the whole app, because the post is too long as it is. But later in Github


r/JetpackComposeDev • • Sep 19 '25

Tool From source codes to templates, landing pages to deep testing - everything is inside one app.

Post image
9 Upvotes

Hi devs,

I just launched an app called AppDadz(https://play.google.com/store/apps/details?id=com.testers.pro) that’s made for developers like us.

  1. It has tons of Android + web project source codes, even games, all downloadable in one click.

  2. You can upload your own apps – others can test them, give suggestions, and report bugs/issues to help improve your project.

  3. If you have valuable stuff like source codes or plugins, you can list them for free. We don’t take any commission – buyers will contact you directly.

  4. The whole idea is to make app development easier and more accessible for everyone.

  5. Contributors get their names added as well.

If you’re an Android app dev, I think you should try it out at least once.


r/JetpackComposeDev • • Sep 12 '25

Tutorial Android 16: Progress-Centric Notifications in Jetpack Compose

Thumbnail
gallery
9 Upvotes

Android 16 introduces progress-centric notifications to help users seamlessly track start-to-end journeys in your app.

Check out this sample Compose app for a hands-on demo:
Live Updates Sample

Perfect for developers looking to improve UX with real-time progress tracking.

Progress-Centric Notifications: Best Practices

  • Set the right fields for visibility.

  • Use clear visual cues (e.g., vehicle image & color for rideshares).

  • Communicate progress with concise, critical text (ETA, driver name, journey status).

  • Include useful actions (e.g., tip, add dish).

  • Use segments & points to show states/milestones.

  • Update frequently to reflect real-time changes (traffic, delivery status, etc.).


r/JetpackComposeDev • • Sep 08 '25

Tutorial How to use Split Buttons in Jetpack Compose (Do & Don’t Tips)

Thumbnail
gallery
9 Upvotes

Learn how to implement split button for toggling related actions in Jetpack Compose. Split buttons open a menu to provide people with more options related to a single action - making your UI more flexible and user-friendly.

Part of Material 3 (introduced in 1.5.0-alpha03*)*

Source code for split button.


r/JetpackComposeDev • • Aug 29 '25

Bottomsheet with sticky button/row

Thumbnail
gallery
9 Upvotes

I am wondering how to implement this bottom sheet with sticky/pinned to the bottom action buttons, like in the picture attached.

P.s. this is a Maps app by Yandex


r/JetpackComposeDev • • Jul 28 '25

Tips & Tricks How to Detect Memory Leaks in Jetpack Compose

Thumbnail
gallery
9 Upvotes

Memory Leak Detection for Android

“A small leak will sink a great ship.” – Benjamin Franklin

LeakCanary is a memory leak detection library for Android.

Add LeakCanary (Start Here)

In your build.gradle (app-level)

debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.14'

That is it. LeakCanary watches your app while you test.
If something leaks (like a screen or object), it notifies you with a clear report.

Good to Know

  • LeakCanary is not included in release builds (AAB/APK)

  • It does not affect production size or performance

  • You don’t need to remove it manually

Get Started

https://square.github.io/leakcanary/getting_started/

Read More (If you want a bug-free app)

How LeakCanary Works


r/JetpackComposeDev • • Dec 29 '25

Wrote a neat Liquid Glass Shader for Jetpack Compose

8 Upvotes

I've been exploring shaders lately, especailly AGSL Shaders using the new RuntimeShader API and I am mindblown. Wrote this one to add a liquid glass effect to any Composable.

https://composeinternals.com/agsl-shaders-jetpack-compose-liquid-glass


r/JetpackComposeDev • • Oct 20 '25

KMP Simplify Cross-Platform Development with Compose Multiplatform

Thumbnail
gallery
8 Upvotes

Tired of writing the same code twice?

As Android developers, we’ve all faced this:

🟢 Writing UI and logic twice for Android and iOS
🟢 Fixing the same bugs on both platforms
🟢 Keeping everything in sync between Kotlin and Swift

What Compose Multiplatform (CMP) offers

✅ Write UI once and run it on Android, iOS, Desktop, and Web
✅ Share business logic across platforms
✅ Use platform-specific features only when needed
✅ Keep performance fully native

Example

@Composable
fun Greeting(name: String) {
    Text("Hello, $name!")
}

The same code runs natively on all platforms, saving time and effort.

How it works

  • Compose code is shared across all targets

  • CMP generates native UI for each platform

  • Platform-specific features can be added when necessary

  • Shared business logic reduces duplication

Why developers love CMP

  • One UI codebase for all platforms

  • Shared logic and native performance

  • Faster development and fewer bugs

  • Works with existing Kotlin projects

Credit : Gourav Hanumante


r/JetpackComposeDev • • Oct 10 '25

Tutorial Morphing Blobs in Jetpack Compose - From Circle to Organic Waves

8 Upvotes

Learn how to create mesmerizing, fluid blob animations in Jetpack Compose using Canvas, Path, and Animatable.

From simple circles to glowing, breathing organic shapes - step-by-step with Bézier curves and motion magic.

Source code : Morphing Blobs with Jetpack Compose, Inspiration: https://dribbble.com/shots/17566578-Fitness-Mobile-App-Everyday-Workout · Git


r/JetpackComposeDev • • Sep 04 '25

I wrote about how I made a big side income from Jetpack Compose: My journey

8 Upvotes

 made near to $200k with a Jetpack Compose book and a course.

I have decided to share these numbers and my journey not to brag, but because I know how motivating it can be to see real examples of what's possible. When I was starting out, I wished someone had been this transparent about their path and actual results. If this helps even one developer take that first step toward building something of their own, or gives someone the confidence to price their expertise fairly, then it's worth sharing. We all benefit when more people in our community succeed.

From sharing online, to writing a book, to launching a course, to making side income from it. Read the full story in https://composeinternals.com/how-i-made-side-income-from-jetpack-compose


r/JetpackComposeDev • • Aug 09 '25

Tutorial How to analyze and improve performance of your Jetpack Compose app?

8 Upvotes

Practical performance problem solving in Jetpack Compose

Make your Compose app run fast by analyzing system traces and fixing common lag causes.

  • Measure, analyze, optimize, and re-measure UI performance

  • Test in release builds with IR8 and baseline profiles

  • Use Jetpack Macrobenchmark for automated testing

  • Use Perfetto to see detailed performance traces

  • Avoid large images on the main thread; use vectors or smaller images

  • Move heavy work off the main thread with coroutines

  • Prevent extra recompositions by reading state later or using stable classes

You can learn optimized the performance of a Compose app. Learn more & Please share what you learn.


r/JetpackComposeDev • • Jul 29 '25

Tutorial How to Animating Composable Bounds with LookaheadScope in Jetpack Compose

8 Upvotes

The animateBounds modifier, introduced at Google I/O 2025, lets you animate a Composable’s size and position in a LookaheadScope for smooth transitions. Ref: Android Developers Blog

What is animateBounds?

  • Animates changes to a Composable’s size and position.

  • Requires LookaheadScope for predictive layout calculations.

  • Perfect for dynamic UI changes, like resizing a box.

Code Example

This eg animates a Box that changes width when a button is clicked.

package com.android.uix
import androidx.compose.animation.ExperimentalSharedTransitionApi
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.*
import androidx.compose.material3.Button
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.animation.animateBounds
import androidx.compose.ui.layout.LookaheadScope
import androidx.compose.ui.tooling.preview.Preview
import com.android.uix.ui.theme.ComposeUIXTheme

@OptIn(ExperimentalSharedTransitionApi::class)
@Composable
fun AnimatedBoxScreen() {
    var isSmall by remember { mutableStateOf(true) }
    Column(
        modifier = Modifier
            .fillMaxSize()
            .padding(16.dp),
        horizontalAlignment = Alignment.CenterHorizontally,
        verticalArrangement = Arrangement.SpaceBetween
    ) {
        LookaheadScope {
            Box(
                modifier = Modifier
                    .animateBounds(this@LookaheadScope)
                    .width(if (isSmall) 100.dp else 150.dp)
                    .height(100.dp)
                    .background(Color(0xFF6200EE))
                    .border(2.dp, Color.Black),
                contentAlignment = Alignment.Center
            ) {
                Text(
                    text = if (isSmall) "Small" else "Large",
                    color = Color.White,
                    fontSize = 16.sp
                )
            }
        }
        Spacer(Modifier.height(16.dp))
        Button(onClick = { isSmall = !isSmall }) {
            Text("Toggle Size")
        }
    }
}

Key Points

  • Setup: Use LookaheadScope and animateBounds to animate size/position.

  • Animation: spring() creates a smooth, bouncy effect.

  • Dependencies: Requires Compose BOM 2025.05.01+.implementation(platform("androidx.compose:compose-bom:2025.05.01"))

Experiment with animateBounds for dynamic UI animations!


r/JetpackComposeDev • • Aug 10 '26

Tips & Tricks 13 Compose Mistakes That Are Still Killing Your App’s Performance in 2026 + Claude SKILL to Find Them

7 Upvotes

🚀 New article is out — 13 Compose Mistakes That Are Still Killing Your App’s Performance in 2026 + Claude SKILL to Find Them

After reviewing many Jetpack Compose codebases, I noticed the same mistakes appearing again and again. Some affect performance, some impact maintainability, and others lead to unexpected UI behavior.

In this article, I cover 13 common Compose mistakes, explain why they happen, and show how to avoid them with practical examples.

As a bonus, I also created a Claude Skill that can analyze your project and help identify these issues automatically using Claude CLI.

📖 Read the article: https://blog.watermelonkode.com/13-compose-mistakes-that-are-still-killing-your-apps-performance-in-2026-claude-skill-to-find-96e91a9697e8

Table of contents:

  1. List<T>

  2. Reading state too high in the composable tree

  3. Unstable lambdas passed into "LazyColumn" items

  4. Forgetting "remember()"

  5. State Update

  6. Forgetting "rememberSaveable"

  7. Not giving "LazyColumn" items a stable "key"

  8. Passing the wrong key (or no key) to "LaunchedEffect"

  9. Forgetting "onDispose", or keying "DisposableEffect" on the wrong lifecycle owner

  10. Reading a changing lambda inside a long-lived effect without "rememberUpdatedState"

  11. Using "rememberCoroutineScope" (or "SideEffect") as a substitute for "LaunchedEffect"

  12. Calling composables or "remember" conditionally in a way that breaks the slot table

  13. Fixing "too many parameters" by shoving a whole data class, or a whole ViewModel, into the signature

  14. 🎁 Bonus: Claude SKILL

If you’re working with Jetpack Compose or Compose Multiplatform, I’d love to hear which mistake you encounter most often.

#AndroidDev #JetpackCompose #ComposeMultiplatform #Kotlin #KMP #AndroidDevelopment #MobileDevelopment #SoftwareEngineering


r/JetpackComposeDev • • Jan 30 '26

[Library] HydroChroma – Fluid physics, glassmorphism, and chromatic aberration for Jetpack Compose (AGSL + RenderEffect)

7 Upvotes

Hi everyone,

I’ve been working on HydroChroma, a Jetpack Compose library that brings "living" fluid design to Android UI.

Why I built this: Most "glass" or "liquid" effects in Android are static images or heavy video files. I wanted a way to make UI elements that react to touch with physics-based fluid distortion and real-time chromatic aberration, running natively on the GPU.

How it works (Technical):

  • AGSL Shaders: It uses a custom RuntimeShader to displace pixels based on a noise algorithm (sin/cos interference patterns) that reacts to a "progress" uniform.

  • Touch Physics: It tracks touch velocity using VelocityTracker. When you drag a card, it calculates a stretch factor (scaleX/Y) to simulate surface tension, making the UI feel "jelly-like."

  • Chromatic Aberration: The shader loops through input colors and offsets them in opposite directions based on the device's tilt sensors (Accelerometer/Gyroscope), creating a 3D holographic depth effect.

  • RenderEffect Chains: It chains RenderEffect.createRuntimeShaderEffect with Blur and ColorFilters to achieve the frosted glass look without killing performance.

Code Snippet:

Kotlin

HydroChroma(
    backdrop = myBackdrop,
    animations = animations(onClick = HydroAction.Fluid),
    liquidGlass = liquidGlassConfig(
        blurRadius = 30.dp,
        refractionAmount = 24.dp
    )
) {
    // Your Composable Content
}

Repository: HydroChroma Jetpack Compose Library

It requires Android Tiramisu (API 33+) due to RuntimeShader requirements. I’d love feedback on the shader performance or the API structure!

Credits:

Kyant0's

* AndroidLiquidGlass

* Capsule


r/JetpackComposeDev • • Nov 17 '25

Tutorial Custom Snackbar component with Success/Error/Warning variants

Thumbnail
blog.oussdev.com
7 Upvotes

r/JetpackComposeDev • • Nov 13 '25

Kprofiles - resource and config management plugin for KMP Compose

7 Upvotes

🚀 Meet Kprofiles for Kotlin Multiplatform Compose

Side note - I've used early versions of this plugin for my own project to deal with multiple resource flavors (in my case it was one app that I shared between multiple brands), but finally figured out that it is time to polish it and share with the community.

Shipping multiple brands/themes/configs on KMP gets messy fast - Android flavors don’t help outside Android, and "copy-paste resources" is no fun to deal with.

Kprofiles makes it clean and predictable:

- Builds one merged resource tree from overlays (Shared → Platform → Build Type → Profiles) with clear last-wins precedence.

- Keeps variants cross-platform and repeatable - no ad-hoc Gradle hacks.

Bonus: comes with a profile-aware config overlay system—so you can drop BuildKonfig entirely and keep environment/config values consistent across targets.

Tested with iOS, Android, JVM, WASM. I'd love early adopters to give it a spin (and a star!) 🙌


r/JetpackComposeDev • • Nov 09 '25

Tutorial How to adapt your app to different screen sizes and provide a better user experience

Post image
7 Upvotes

Android Basics with Compose - Adapt for different screen sizes

In this pathway you'll learn how to adapt your app to different screen sizes and provide a better user experience, as well as how to test your adaptive UI.

https://developers.google.com/profile/badges/playlists/android/android-basics-compose-unit-4-pathway-3


r/JetpackComposeDev • • Oct 12 '25

News Build a Kotlin Multiplatform Project and Win a Trip to KotlinConf 2026

Thumbnail
blog.jetbrains.com
7 Upvotes

Big news for students and recent graduates - the Kotlin Multiplatform Contest 2025 is now open!

Prizes

  • Top 3 projects → Free trip to KotlinConf 2026 (travel, stay, swag, and spotlight!)

  • All participants → Kotlin souvenirs + community recognition


r/JetpackComposeDev • • Sep 26 '25

Tips & Tricks Top 15 IntelliJ IDEA shortcuts

Thumbnail
youtu.be
7 Upvotes

IntelliJ IDEA has keyboard shortcuts for most of its commands related to editing, navigation, refactoring, debugging, and other tasks. Memorizing these hotkeys can help you stay more productive by keeping your hands on the keyboard.

https://www.jetbrains.com/help/idea/mastering-keyboard-shortcuts.html


r/JetpackComposeDev • • Sep 04 '25

Tutorial Text Styling in Jetpack Compose - Colors, Fonts, Shadows, Gradients & More

Thumbnail
gallery
7 Upvotes

Learn how to style text in Jetpack Compose with color, size, bold, italic, shadows, gradients, HTML links, multiple inline styles, and marquee effects.


r/JetpackComposeDev • • Sep 01 '25

Pathfinder - A Lightweight Jetpack Compose Navigation Library

7 Upvotes

Hey folks,

I’ve been building a navigation library for Jetpack Compose called Pathfinder, built on top of Navigation 3. It came out of frustrations I had with the current navigation APIs, and I wanted something type-safe, testable, and extensible.

Some of the built-in features include:

  • Sending/receiving results between screens

  • Launching standard activities

  • Managing dialogs with ease

  • Screen chaining (helpful for deep links)

If navigation has ever felt tedious in your Compose projects, Pathfinder might smooth out some of those rough edges. I’d love your feedback, suggestions, or even just to hear how you currently handle navigation in Compose.

GitHub: ampfarisaho/pathfinder


r/JetpackComposeDev • • Aug 19 '25

Tutorial How to implement common use cases with Jetpack Navigation 3 in Android | Compose Navigation 3

7 Upvotes

This repository contains practical examples for using Jetpack Navigation 3 in Android apps.

Included recipes:

  • Basic API

    • Basic usage

    • Saveable back stack

    • Entry provider DSL

  • Layouts & animations

    • Material list-detail

    • Dialog destination

    • Custom Scene

    • Custom animations

  • Common use cases

    • Toolbar navigation

    • Conditional flow (auth/onboarding)

  • Architecture

    • Modular navigation (with Hilt)

  • ViewModels

    • Pass args with viewModel()

    • Pass args with hiltViewModel()

https://github.com/android/nav3-recipes


r/JetpackComposeDev • • Aug 13 '25

Discussion Is it possible to build this in Kotlin Multiplatform?

7 Upvotes

I am building a simple application with a sign-up form, API integration, and a payment gateway. The requirement is to support Android, iOS, and Web.

I started with Kotlin Multiplatform, but the payment gateway I need does not support Web, and I could not find any third-party SDK for it.

Is it possible to make this application in Kotlin Multiplatform with these requirements? If not, is there any way to work around this, or should I use another framework like Flutter?