I've been developing Android apps with Java for a few years and I have to say that I'm not a big fan of its syntax where the developer has to write many lines the code for simple stuff, for example, reading from a file. Luckily for us Kotlin has come to the rescue.
Kotlin is the newest and hottest programming language for Android that stands out for being concise and safe. At work, I have started to use it for non-production code and it is AWESOME! That is why I have decided to start this blog series where I'm going to discuss some of the features of Kotlin while building an Android app to display the crypto market capitalization.
Let's start by creating our first Android project with Kotlin.
We're going to need Android Studio, you can download it and still it from here:
https://developer.android.com/studio/index.html
Kotlin is bundled with the latest version of Android Studio 3.0.1
After installing the IDE we're going to create a new project by clicking on "Start a new Android Studio project". Select a name for the new project and use the empty activity template
After the IDE finish setting up the project we'll have a project with a MainActivity in Java. The next step is to setup Kotlin in our project, the easiest way to do it is by using the action search Command + Shift +A, type Convert Java file to Kotlin file in the search box.
Next, we need to configure Kotlin in our project. We can search for the Configure Kotlin in Project action in AS.
We are ready to run our first app in Kotlin. Click on run app button, select a target device or create an emulator.
There you go! We have our android project ready to start.
In the next post, we're going to review Kotlin features and what it makes it so great for developing android apps.
Cheers!