RecyclerView, Room, Gradle and Compose basics
Build efficient lists, store data with Room off the main thread, add libraries with Gradle and handle Compose state.
Most app screens show a list of data loaded from storage or the network. Doing that smoothly depends on three rules: reuse views, keep slow work off the main thread, and make state observable.
RecyclerView
RecyclerView creates only enough rows to fill the screen and recycles them as the user scrolls. Your adapter has three jobs: onCreateViewHolder() inflates a row, onBindViewHolder() fills it with data for a position, and getItemCount() returns the size. Keep binding cheap; do not load images synchronously or allocate heavy objects there. When data changes, prefer ListAdapter with DiffUtil over calling notifyDataSetChanged(), so only changed rows update.
Room
Room has three parts: an @Entity class for each table, a @Dao interface with methods annotated @Query, @Insert and so on, and a @Database class that ties them together.
@Dao
interface NoteDao {
@Query("SELECT * FROM notes ORDER BY created DESC")
fun observeAll(): Flow<List<Note>>
@Insert
suspend fun insert(note: Note)
}By default Room throws an exception if you query on the main thread. Use suspend functions or Flow and call them from a coroutine. Network calls follow the same rule and throw NetworkOnMainThreadException if made on the main thread.
Gradle basics
Each module has its own build file, build.gradle or build.gradle.kts. Libraries go in its dependencies block with implementation(...); test-only libraries use testImplementation. Settings like minSdk and targetSdk live in the android block. After editing, sync the project.
Jetpack Compose state
A composable redraws, or recomposes, when state it reads changes. Plain variables are not state:
var count by remember { mutableStateOf(0) }remember keeps the value across recompositions; rememberSaveable also keeps it across rotation. For screen data, hoist state into a ViewModel and pass values and event callbacks down to composables.
Checklist: rows recycle cleanly, no database or network work on the main thread, and every value the UI shows comes from observable state.
More in Web and app