Questions
Kotlin questions
Choose a question page, learn the concept, then test your understanding with a quiz.
How to Remove Duplicate Strings from an Array in Kotlin
Learn how to remove duplicate strings from an Array<String?> in Kotlin using distinct(), sets, and null-safe examples.
How to Set Text in an EditText in Kotlin
Learn why EditText.text expects Editable in Kotlin and how to correctly set and read text using setText(), text, and toString().
How to Set an OnClickListener in Kotlin for Android
Learn how to use setOnClickListener in Kotlin for Android with clear examples, syntax, common mistakes, and a practical mini project.
How to Update the Kotlin Gradle Plugin in a Flutter Android Project
Learn where to change the Kotlin Gradle plugin version in a Flutter Android project and how it differs from Kotlin stdlib.
How to Use LIKE in Android Room Queries
Learn how to write Room SELECT queries with LIKE in Android, including wildcards, parameter binding, and common mistakes.
How to Use Links and Code Formatting in Kotlin KDoc
Learn how to write links and inline code in Kotlin KDoc, including JavaDoc equivalents, syntax examples, and common mistakes.
How to Use Nullable Boolean in Kotlin if Expressions
Learn the safest way to use Boolean? in Kotlin if expressions, including smart casts, properties, and null-safe alternatives.
How to Use break and continue with forEach in Kotlin
Learn why break and continue do not work directly in Kotlin forEach, and how to use labels, returns, and regular loops instead.
How to Vibrate an Android Device in Java: Vibrator and VibrationEffect
Learn how to make an Android device vibrate in Java using Vibrator and VibrationEffect, including patterns, permissions, and common pitfalls.
How to Work with Multiple Nullable Variables in Kotlin Using let
Learn how to handle multiple nullable values in Kotlin using let, safe calls, guards, and practical null-check patterns.
Idiomatic Logging in Kotlin: Companion Objects, Properties, and Best Practices
Learn the idiomatic way to create and use loggers in Kotlin using companion objects, properties, and practical logging patterns.
Java 8 Stream.collect Equivalents in Kotlin Standard Library
Learn the Kotlin stdlib equivalents to Java 8 Stream.collect with examples for grouping, partitioning, joining, sums, and set/list collection.
Java Static Methods in Kotlin: Equivalents and Best Practices
Learn how Kotlin replaces Java static methods using top-level functions, companion objects, and objects with clear examples.
Java static final Equivalent in Kotlin: Constants with const val and Companion Objects
Learn the Kotlin equivalent of Java static final fields using const val, val, top-level declarations, and companion objects.
Kotlin Companion Object Explained: Static Replacement, Meaning, and Best Practices
Learn what a Kotlin companion object is, why it replaces Java static members, and when to use it for factories, constants, and singletons.
Kotlin Constants: Recommended Ways to Declare and Name Them
Learn how to create constants in Kotlin, when to use const val vs val, and the standard naming conventions with clear examples.
Kotlin Data Class Default Constructor and Optional Parameters in Android
Learn how to create an empty-like constructor for a Kotlin data class using default parameter values in Android.
Kotlin Double-Bang Operator (!!): Meaning, Null Safety, and Safer Alternatives
Learn what Kotlin's !! operator means, when it throws NullPointerException, and which safer null-handling options to use instead.
Kotlin Equivalent of Java String[]: Arrays of Strings Explained
Learn the Kotlin equivalent of Java String[] and understand Array<String>, primitive arrays, syntax, examples, mistakes, and usage.
Kotlin Generics: Difference Between `*` and `Any`
Learn the difference between `SomeGeneric<*>` and `SomeGeneric<Any>` in Kotlin generics, with examples of star projections, variance, and safe usage.