Questions

Kotlin questions

Choose a question page, learn the concept, then test your understanding with a quiz.

Accessing Kotlin Extension Functions from Java

Learn how Kotlin extension functions are compiled and how to call them correctly from Java with clear examples and common pitfalls.

kotlinjavaextension-function

Allow HTTP and HTTPS in Android 9 Pie with Network Security Configuration

Learn how Android 9 Pie handles cleartext HTTP traffic and how to allow HTTP and HTTPS safely using network security config.

kotlinjavaandroidandroid-9.0-pie

Android AlarmManager Example: Scheduling Tasks with AlarmManager

Learn how to use Android AlarmManager to schedule tasks, set alarms, and handle broadcasts with a simple beginner example.

kotlinjavaandroidalarmmanager

Android Foreground Service Notification Channels in Kotlin

Learn why startForeground fails on Android 8.1 and how to create a valid notification channel for foreground services in Kotlin.

kotlinandroidserviceandroid-notifications

Android Room Main Thread Error: How to Run Queries Safely in Java/Kotlin

Learn why Room blocks database access on the main thread and how to fix it using background threads, executors, and async patterns.

kotlinandroidcrashandroid-studio-3.0

Android onBackPressed Deprecation: Modern Back Handling in Kotlin

Learn the alternative to deprecated onBackPressed() in Android using OnBackPressedDispatcher and OnBackPressedCallback in Kotlin.

kotlinandroidnavigationdeprecation-warning

AsyncTask Alternatives in Android: Replacing Deprecated AsyncTask with Executor and Handler

Learn how to replace deprecated AsyncTask in Android using Executor, Handler, and modern concurrency patterns for older codebases.

kotlinjavaandroidandroid-asynctask

Builder Pattern in Kotlin: How to Build Objects Idiomatically

Learn how to implement the Builder pattern in Kotlin, when to use it, and which Kotlin features often replace builders.

kotlindesign-patterns

Can You Extend a Data Class in Kotlin? Inheritance, Limits, and Better Alternatives

Learn why Kotlin data classes cannot be extended, what causes the component function clash, and which alternatives to use instead.

kotlininheritanceabstractdata-class

Convert a Kotlin Array to Java varargs: Passing Arrays to Java Methods from Kotlin

Learn how to pass a Kotlin Array or ArrayList to a Java varargs method using the spread operator and type conversion.

kotlinjavainteropkotlin-interop

Difference Between List and Array in Kotlin

Learn the difference between List and Array in Kotlin, including mutability, size, APIs, performance, and when to use each one.

kotlinarrayslist

Fix Hilt Unsupported Metadata Version Error in Kotlin

Learn why Hilt fails with an unsupported metadata version in Kotlin and how to fix version incompatibility in Android projects.

kotlinandroid-studiomobileandroid-jetpack-compose

Fix Incompatible Kotlin Metadata Version Error in Android/Gradle

Learn why the Kotlin metadata version error happens in Android builds and how to fix mismatched Kotlin and Gradle versions safely.

kotlinandroidandroid-studio

Fix KaptExecution Error in Android Kotlin: Data Binding and Build Generation

Learn why KaptExecution fails in Android Kotlin builds, especially with data binding and generated classes, and how to fix it step by step.

kotlinandroidandroid-studio

Fix Kotlin Version Mismatch Between Gradle and Android Studio Plugin

Learn why Kotlin version mismatch happens between Gradle and Android Studio, and how to fix it safely in Android projects.

kotlinandroid-studio

Fix PendingIntent FLAG_IMMUTABLE or FLAG_MUTABLE Error in MediaSessionCompat on Android 12+

Learn why MediaSessionCompat crashes on Android 12+ with PendingIntent flags and how to fix it using updated AndroidX media libraries.

kotlinjavaandroidandroid-studio

Fix compileJava and compileKotlin JVM Target Mismatch in Gradle Kotlin DSL

Learn how to set matching Java and Kotlin JVM targets in build.gradle.kts and fix compileJava 11 vs compileKotlin 1.8 errors.

kotlinjavaandroid-gradle-plugindependencies

Fixing "Default Interface Methods" Error in Android: Java 8, D8, and LifecycleObserver

Learn why Android shows the default interface methods error, how Java 8 affects minSdk, and how to fix it with D8 and Android lifecycle libraries.

kotlinandroidjava-8

Fixing "Inappropriate Blocking Method Call" in Kotlin Coroutines

Learn why Kotlin shows "inappropriate blocking method call" and how to correctly use blocking APIs like OkHttp and Moshi in coroutines.

kotlinokhttpkotlin-coroutinesmoshi

Fixing "navigation destination is unknown to this NavController" in Android Navigation

Learn why Android Navigation throws "destination is unknown to this NavController" and how to fix graph, action, and Fragment issues.

kotlinandroidandroid-architecture-navigationandroid-navigation

Page 1 of 6 - 112 questions

PreviousNext