Here at shinobi HQ we were really excited when Google announced support for Kotlin and were interested to see how developers would embrace it. With Kotlin’s growing popularity we were keen to test Google’s promise of it being “totally interoperable with existing code“.
I decided to take our simple shinobicharts quickstart sample app and rewrite it in Kotlin. I was rather surprised at what a simple task this was.
I began by opening up the sample project in Android Studio which at time of writing is v3.0.1. After opening up the ShinobiQuickStartActivity.java file I hit code->Covert Java File to Kotlin File. After a brief moment of chugging Android Studio presented me with an Activity class that looked very different (not to mention leaner) to it’s Java counterpart.
Following a failed attempt to run the app I was prompted to configure Kotlin. Choosing ok to the default options, a configuration followed by a gradle sync left things in much better shape. A quick re-run and the shinobichart was presented in all it’s glory.
As we have seen the task of converting existing Java code into Kotlin is simple. What this post also shows us is how Kotlin and shinobicharts work well together.
We hope to see some of you working with shinobicharts and Kotlin in the near future and would love to hear how you get on. Please do get in touch!