Procrastination Diary: My First Dive into Kotlin

Trying new languages is fun. I make that face irl.

TL; DR: I made a simple WebView App. The source code is available on my Gitlab, and the app is on the Google App Store.

Background story first!

I can’t have Chrome web browser on my phone. I just can’t trust myself not drowning my sorrows in memes. But how do I access webapps for work like HackNPlan? I don’t want to sign in for every single access because I’m super lazy. Thus, this little WebView project was born.

My colleagues and I back here at Vifth Floor have been working on a game demo/pre-production that is yet to be released to the public for quite some time. I was bored and decided to procrastinate a bit to maintain my sanity. The boss himself shared a TED talk video about how creative process needs a bit of a stalling action on #random. Well, then I’m so doing this distraction.

From Scratch

Android Studio was not installed on my laptop, so it was downloaded specifically for this little project. The download time was wayyy to long because of the SDKs. I didn’t even try to get the virtual devices because I knew I’d be disinterested by the time the download was finished.

A little pet-peeve about the NDK, it can’t be placed in a folder which path had spaces on them. Good thing I didn’t install the Android SDK in the Program Files folder so there was not problem with the downloaded NDK. I was going to make a tiny Kotlin App; I didn’t need NDK anyway.

I followed this tutorial on making a simple WebView App. This splash screen tutorial is super short so I was bought. A little discussion here on StackOverflow got me started on using cache.

Well, that’s all it took to make the app so far.

Kotlin + Android Studio = Magic!

For this project I chose to use Kotlin just because; not unlike the reason behind this entire project. The code became shorter. Also, there are all kinds of nifty language features that are unavailable on Java.

One of the good things about Kotlin is I don’t need to add a semicolon on the end my statements. This took me back to the Programming 101 days back in Uni and there was a written quiz on Java. One forgotten semicolon, the answer lose half of its value. I didn’t have any background on programming at the time, and I thought to myself, these kinds of mistakes must happen all the time. About me, I’m right.

Any Java programmer working on Android very likely passed the phase where it’s null pointer exception everywhere. We have to add null checks or try-catch for that. To do that in Kotlin, we just have to add one character. One character, and I don’t have to worry about null pointer anymore. Ah well, the downside is I can’t make memes about null pointer exception anymore.

Google Play Publishing is as easy as 1, 2, …

Google Play Release? Because, again, why not? I was just in the mood for trying things out. The one-time registration fee is only $25 anyway. The review process was lightning fast; it only took a few minutes. Probably because the app is set as unreleased and in beta.

How do I use this app?

I’m using this app as a HackNPlan Web Browser, so I filled the home page field with “https://app.hacknplan.com” and the host name with “hacknplan.com”. Then, a final touch, I changed the app icon and name on my phone with my launcher app so it looks less like a generic web browser app and more like an official app.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.