The title might sound weird at beginning since many modern libraries or tools are designed to make developers write less code via ways like code generation or reflection. Those libraries are great and convenient to use because we write less code. However in my experience sometimes developers become careless and…


This is not something fancy or magical about Kotlin at all, but I was asked about this multiple times in the past few months, so I think this may be something worth to share.

The following code will not compile in Kotlin, and IDE shows an error: Smart cast to…


In my previous post, Kotlin “By” Class Delegation: Favor Composition Over Inheritance, I covered using theby keyword for class delegations. You can easily reuse and compose existing concrete implementations in your code. In this post, I will be going over using the same by keyword for properties and how you…


KotlinConf is the first ever conference that is all about the new favorite language, Kotlin. The event is held by JetBrains at Pier 27, San Fransisco. It is two days long, and you can see many developers from big companies like Google, Gradle, Pivotal, and Facebook giving talks or attending…


When people ask me why I choose Kotlin over Java, I often say, “Because Kotlin is a better Java.” You get more than half of Effective Java implemented for you. In chapter 4 of the book, the author lists many items about inheritance because it is very error prone. The…


A week ago I was thinking of writing a small Kotlin command line tool to read some local JSON files. I opened IntelliJ and started a Kotlin project with Gradle. Everything worked just fine. I could compile and run the output jar file until I imported autovalue. Autovalue uses an…


I use gitlab and its built-in CI for my person blog (see details). Today I was trying to “update” hugo in the docker image, and I found myself making a couple of mistakes, including losing the dockerfile for the base image I built a long time ago! …


Genymotion is the most popular replacement for Android emulator, but by default it does not come with Google play services and play store. You will have to follow this guide and manually install one or two zip files to install required files. But now with version 2.10 …


Writing custom views or view groups is quite common nowadays, but sometimes it can be really cumbersome. You have to write overloaded constructors so that they would work properly in layout editor, or you define and implement some interfaces so that you don’t have to copy and paste the same…


Kotlin defines a few of extension functions like with() and apply() in its Standard.kt file. You probably have seen some of them in various tutorials or even used them already. Sometimes you may also wonder which one to use. …

Eric Lin

Honest Android developer. Loves Kotlin and new technologies.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store