Kotlinx Datetime

Dependency Add the following to your dependencies implementation(org.jetbrains.kotlinx:kotlinx-datetime:0.2.0) Usage import kotlinx.datetime.* val today = Clock.System.todayAt(TimeZone.currentSystemDefault()) If you target Android devices running below API 26, you need to use Android Gradle plugin 4.0 or newer and enable core library desugaring. https://github.com/Kotlin/kotlinx-datetime

How to create a mutable list in Kotlin?

Kotlin has its own keyword to create list which are mutable As a child I learned that our solar system has nine planets val planets = mutableListOf(“Mercury”, “Venus”, “Earth”, “Mars”, “Jupiter”, “Saturn”, “Uranus”, “Neptune”, “Pluto”) println(planets) In 2006 Pluto was reclassified as a dwarf planet. So let’s remove Pluto planets.remove(“Pluto”) println(planets)

Network Requests with Volley

Consider Volley a 2.0 version of Android Asynchronous Http Client. A major advantage of Volley over ASyncTask is that you can do multiple requests simultaneously without the overhead of thread management. Gradle Add implementation ‘com.android.volley:volley:1.2.1’ to your module gradle dependencies. Basic Anatomy of a Volley Request val queue = Volley.newRequestQueue(context) val stringRequest = StringRequest( Request.Method.GET,…

New Blog Post

What is Beta decay?

Beta decay is the process where a nucleon decays into either an electron or a positron. β− decay (electron emission) n → p + e− + ν A neutron decays into proton, an electron and an anti-neutrino. β+ decay (positron emission) p → n + e++ νe A proton decays into a neutron, a positron…

Localization of Android Apps

If you want to add another language for your app do the following Create a new folder e.g. app/src/main/res/values-de Add strings.xml into this folder Translate the content The cool thing about translation in android is that you can do it incrementally: when there is no translation for a string resource in a locale Android will…