Working with Kotlin Data Classes, Sealed Classes, and Generics
Data Classes
In Kotlin, data classes are specifically designed to hold data. The data keyword marks a class as a data class, automatically generating several useful methods.
data class UserProfile(val identifier: String, val years: Int)
When you declare a data class, the compiler automatically generates the following members from the primary ...
Posted on Thu, 27 Aug 2026 16:22:09 +0000 by XzorZ
Getting Started with Jetpack Compose Fundamentals
Composable Functions and Preview Annotations
package com.example.jetpackcompose
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.c ...
Posted on Sun, 23 Aug 2026 16:54:51 +0000 by sottwell
Building a Cross-Platform Navigation Framework with Kotlin Multiplatform
Motivation for a Custom SolutionKotlin Multiplatform (KMP) web support is still in its infancy, and the iOS target is in beta. The ecosystem currently lacks mature, open-source cross-platform navigation libraries, forcing developers to rely on platform-specific implementations. A custom router bridges this gap, providing shared navigation logic ...
Posted on Sat, 15 Aug 2026 15:59:26 +0000 by alpine
Kotlin Advanced Concepts and Practical Patterns
Kotlin prvoides multiple ways to declare and manage properties with different initialization behaviors.
// Late-initialized property: must be assigned before use, can be reassigned
lateinit var userData: String
// Delegated property initialized lazily on first access
val userName: String by lazy { "sherlbon" }
// Nullable property w ...
Posted on Sun, 09 Aug 2026 16:34:08 +0000 by CooKies37
Getting Started with GraphQL Kotlin
Introduction to GraphQL Kotlin
GraphQL Kotlin is a collection of libraries built on top of graphql-java, specifically designed for the Kotlin language. Its primary goal is to streamline the development of both GraphQL clients and servers. This guide provides an overview of the project's key features and how to use them effectively.
Project Over ...
Posted on Tue, 04 Aug 2026 16:00:20 +0000 by Shygirl
Kotlin Scope Functions: Choosing the Right One for Your Code
Overview
Kotlin's standard library provides several utility functions designed to execute a block of code within a specific object's context. When invoking these functions on an object with a lambda expression, a temporary scope is established where the object becomes accessible without explicit naming. These utilities are collectively known as ...
Posted on Sat, 01 Aug 2026 17:03:14 +0000 by gamerzfuse
Exploring Kotlin's Visibility Modifiers: Scope Rules for Top-Level, Class, and Module Declarations
Kotlin provides four visibility modifiers: private, protected, internal, and public. The default visibility, when no modifier is explicitly applied, is public.
Top-level declarations—such as functions, properties, classes, objects, and interfaces—live direct within a package:
// File name: utils.kt
package com.sample.utils
// Visibility rules ...
Posted on Thu, 23 Jul 2026 16:52:14 +0000 by elementaluk
Composing Suspending Functions with Kotlin Coroutines
Sequential Invocation
Consider defining two distinct suspending functions that perform operations like remote service calls or computations. The functions themselves are presumed to be useful, but for this example, they simply delay for one second before returning a result:
suspend fun fetchFirstValue(): Int {
delay(1000L) // Simulates a us ...
Posted on Thu, 23 Jul 2026 16:18:24 +0000 by CFennell
Dependency Injection with Hilt in Android Applications
Dependency Setup
Add the following dependencies to your module-level build.gradle file:
dependencies {
implementation("com.google.dagger:hilt-android:2.44")
annotationProcessor("com.google.dagger:hilt-android-compiler:2.44")
}
Apply the Hilt plugin in the same file:
plugins {
id("com.android.application&quo ...
Posted on Tue, 14 Jul 2026 16:19:28 +0000 by surfer
Displaying Real-time Progress on Android SeekBar
Displaying Real-time Progress on Android SeekBar
The SeekBar is a fundamental UI component in Android that allows users to select a value by dragging a thumb along a track. A common requirement is to display the current progress value dynamically, updating in real-time as the user interacts with the slider. This guide demonstrates how to achiev ...
Posted on Fri, 10 Jul 2026 16:10:42 +0000 by phigga