Arun Chandravanshi

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 »

Android Jetpack Proto DataStore Example

This blog is about Android Jetpack Proto DataStore and how to implement Proto DataStore in our Android application. Proto DataStore Proto DataStore stores data as objects of a custom data type. When using Proto DataStore, you have to define a schema using protocol buffers. Creating New Project 1 . Create a new project by going to File ⇒ New

Android Jetpack Proto DataStore Example Read More »

Android Jetpack Preferences DataStore Example

This blog is about Android Jetpack DataStore Preferences and how to implement DataStore Preferences in our Android application. DataStore Jetpack DataStore is a data storage solution. It allows us to store key-value pairs (like SharedPreferences) or typed objects with protocol buffers (discuss in the next article). DataStore uses Kotlin, Coroutines and Flow to store data asynchronously with consistency

Android Jetpack Preferences DataStore Example Read More »

Android highlight the paragraph in TextToSpeech

This post is about how to change paragraph color which is current speaking in TextToSpeech. Creating new project 1. Create a new project by going to File ⇒ New Android Project, fill the required details and then click on finish. 2. The below layout file consist of two textView and a button to trigger an event that will highlight the

Android highlight the paragraph in TextToSpeech Read More »

Android highlight a word in TextToSpeech

This post is about how to highlight the word while speech is running in TextToSpeech. Creating new project 1. Create a new project by going to File ⇒ New Android Project, fill the required details and then click on finish. 2. The below layout file consist of two textView and a button to trigger a event that will highlight the

Android highlight a word in TextToSpeech Read More »