Kotlin Map

In this tutorial, we will talk about Kotlin Map with the help of simple examples. Map Maps are used to store key and value pairs. In Map: key and value are user defined. The key should be unique and only one value can be stored for each unique key. Values can be duplicate. A key value […]

Kotlin Map Read More »

Kotlin List

In this tutorial, we will talk about Kotlin List with the help of simple examples. List  An ordered collection of elements. The ordered is maintained through indices (same as arrays). Indices start from zero(the index of the first element) and go to lastIndex which is the (list.size – 1). An element (including null) can occur

Kotlin List Read More »

Kotlin Null Safety

This tutorial is about Null Safety in Kotlin. Null Safety in Kotlin is to eliminate the risk of occurrence of NullPointerException from code. One of the most common pitfalls in many programming languages, including Java, is that accessing a member of a null reference will result in a null reference exception. In Java this would

Kotlin Null Safety Read More »

Android Audio Recorder Example

This tutorial is about how to implement audio recorder in android with the help of a simple application. MediaRecorder Class In android, MediaRecorder class will provide a functionality to record audio or video files. In android, to record an audio we need to use device’s microphone along with MediaRecorder class. In case, if we want to record video, we

Android Audio Recorder Example Read More »

Kotlin Data Classes

This tutorial is about Kotlin Data classes, requirements that data class must fulfill, and their standard functionalities. Data Classes Data classes  are classes whose main purpose is to hold data/state and contains standard functionalities. A data keyword is used to declare a class as a data class. Example: data class Student(val name: String, val age: Int)

Kotlin Data Classes Read More »

Kotlin Object Declarations and Expressions

This tutorial is about object declarations (singletons) and object expressions with the help of examples. Object Declarations Object declarations defines singletons. Singleton is an object-oriented pattern where a class can have only one instance (object) at a time. Kotlin creates singletons with the object keyword. The object declaration can have functions, properties, and the init

Kotlin Object Declarations and Expressions Read More »

Kotlin Companion objects

This tutorial is about companion objects in Kotlin with the help of examples. Kotlin doesn’t have a static keyword. Static members belong to a type, and not to an instance of a type. In kotlin to achieve this static feature, we make use of companion object. companion object An object declaration inside a class can be

Kotlin Companion objects Read More »

Kotlin Getters and Setters

This tutorial is about how to use getters and setters in Kotlin with the help of simple example. Getters and Setters Getters are used for getting value of the property and Setters are used for setting the value of the property. Setters can have visibility modifiers but Getters always have the same visibility as the

Kotlin Getters and Setters Read More »

Android Jetpack CameraX Example

This post is about Android Jetpack CameraX API and how to implement it in an android application with a simple basic example. CameraX CameraX is a Jetpack support library, makes it easier to add camera capabilities to your app. It has backward compatibility down to Android API 21. It uses a simpler, use case-based approach

Android Jetpack CameraX Example Read More »

Kotlin Visibility Modifiers

This post is about Access/Visibility modifiers in kotlin and how to use them. Access Modifiers In Kotlin, visibility modifiers are used to restrict the accessibility of Classes, objects, interfaces, constructors, functions, properties and their setters to a certain level. Getters always have the same visibility as the property. There are four visibility modifiers in Kotlin: public protected internal

Kotlin Visibility Modifiers Read More »