Home / Programming (page 2)

Programming

Background Processing in Android using Async Task Loader

AsyncTaskLoader is a subclass of Loader, unlike AsyncTask’s, AsyncTaskLoader prevent duplication of background threads and eliminate duplication of zombie (dead or destroyed) activities. First, let’s talk about Loaders. What are Loaders? The Loader API lets you load data from a content provider or any other data source for display in an FragmentActivity or Fragment – Developer.Android.com …

Read More »

Kotlin Data Classes

In this tutorial we are going to discuss kotlin data classes, and show some examples on how you can use them in your app. We frequently create classes whose main purpose is to hold data. In such a case some standard functionality and utility functions are often mechanically derivable from …

Read More »

Kotlin Function Overriding Rules

Overridden functions of an open class is open by default and we can stop that by using the final Keyword Meaning we can override and inherit overridden method by default. Let’s say we built a learning app. Course is our abstract class, KotlinCourse inherits or extends Course, SpecialKotlinCourse also inherits or extend KotlinCourse. As you …

Read More »

Kotlin Interface Examples

Kotlin Interface Examples

An interface defines a contract for classes. An interface is similar to an Abstract class just that, an Abstract class is a collection of abstract methods and variables. Let’s say we have an interface called Driveable. interface Driveable { fun drive() // declaring 'abstract' is implicit and unnecessary } we can …

Read More »

Kotlin: Class Examples

Class without a Constructor but with default variable (or properties or data) class Person { val name : String = "Peter" // Default Variable var age : Int = 30 // Default Variable } fun main (args: Array<String>){ val person = Person() // this line tell kotlin to instantiate a …

Read More »