Kotlin Nested and Inner Classes, Anonymous Objects, and Enum Classes
Kotlin supports nesting classes within other classes. A nested class is declared directly enside another class and does not hold a reference to a instance of the outer class:
class Outer {
private val value = 1
class Nested {
fun getValue() = 2
}
}
val result = Outer.Nested().getValue() // Returns 2
When a nested class is ...
Posted on Sun, 10 May 2026 12:35:52 +0000 by alex_lana
Kotlin Classes and Inheritance Fundamentals
Class Definition
Kotlin uses the class keyword to declare classes. A class declaration consists of a name, an optional class header (specifying type parameters, primary constructor, etc.), and a class body enclosed in curly braces. Both the header and body are optional; if a class has no body, you can omit the curly braces.
// Simple class defi ...
Posted on Sat, 09 May 2026 20:23:40 +0000 by creet0n
Implementing a Custom Bottom Navigation Bar with ViewPager2 on Android
Project Dependencies
To utilize the modern ViewPager2 component, include the following dependency in your build.gradle file:
implementation "androidx.viewpager2:viewpager2:1.0.0"
Base Class Architecture
Establishing a robust architecture requires defining base classes for Activities and Fragments to handle data binding, ViewModels, and common ...
Posted on Fri, 08 May 2026 23:14:56 +0000 by phpflixnewbie