My first time develop android app

Irwan Shofwan
2 min readApr 20, 2020

--

I only share my personal experience what I learn when I try hands on develop android app. A lot of things I didn’t expected before, like impression of kotlin, kotlin bytecode, create UI for android apps, etc.

Kotlin is very simple!!!

Honestly I never expected kotlin will be very simple than Java. I ever heard in tech blog about kotlin will be next generation of Java, but personally I don’t believe that until I try by self, and now I believe that is true. Kotlin is very simple, maybe for some people kotlin look like swift but I don’t care about it as long as it simple its sounds good to me :)

// The simplest range in java 
Range.closed(1, 5).asSet(DiscreteDomains.integers());
// Range in kotlin
1..5

The snippet code show the simplicity in kotlin, in Java by default we can’t generate a range like example but we need extra library to do that, in this case the library I used is Guava. Kotlin by default can generate range like ruby does, only using following this format and you will have rangeInt object start..end.

Convert Kotlin into Java and vice-versa

Kotlin able convert to Java and vice-versa, it possible because both of them will be convert into bytecode. Basically bytecode is the language JVM understand. Because Java and Kotlin use a same bytecode it possible to convert each other. Maybe if you curious how java converted into bytecode you can see my antoher post in here. But still I choose Kotlin.

Android app layout

Creating layout in android for basic app it’s quite easy I think because the component consist of xml and it’s look like html. I don’t know but if I compared with layoutin iOS app I think android more simple and we can see the changes directly from IDE.

Extend the simplicity

Few days ago I tried to create a simple calculator apps, my first idea is using eval. Eval function built in function to do string calculation, what I mean eval in python language. Because kotlin adopt the simplicity I think kotlin will have that function, after try figure out the asnwer is only available in kotlin js https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.js/eval.html.

Fortunately kotlin easily can extend the simplicity using depedency. So I used depedency to do that and it’s work exactly like what I want.

Notes: All writen in this post in my personal opinion based experience

--

--