Posts

Showing posts from October, 2017

Why Use Kotlin for Building Android Apps?

Kotlin is an officially supported language for building Android apps and this announcement came out at the Google I/O 2017.
Kotlin isn't a language that was created a few months back, it has been around for 6 years. The creator of this language is JetBrains, the company that provides the best IDE's like IntelliJ IDEA, PyCharm for developers. Kotlin already has a considerable user base and these numbers will rise in the coming years.
According to a prediction by Realm (the company behind the mobile-friendly database), Kotlin will overtake Java in December 2018 as the preferred language for Android app development. The report pointed out that the Android developers that are hesitant to learn Kotlin will face the same fate as the dinosaurs.
Those are pretty harsh words, but if Oracle keeps creating issues, then Google will continue to push for better support for Kotlin.
Many in the developer community see the current situation of apps building with Java or Kotlin for Android pla…

Create Your First Android Project with Kotlin

Image
Building Android apps with Kotlin is as simple as selecting an option when creating a project. For this you need Android Studio 3.0.
Create a Kotlin Project: 1) Start a new project as you usually you do with Android Studio.

2) Here in the Create New Project window, you have to select the Include Kotlin Support option at the bottom.

3) The rest of the steps (selecting the SDK version, Selecting your starter activity and customizing it) remains the same.




4) Finally, click finish to create your first Kotlin project.

Changes happened compared to Java project:1) Instead of creating MainActivity.java, the IDE now creates MainActivity.kt file.

2) kotlin-android, kotlin-android-extensions plugins and appropriate dependency were added to the module level build.gradle file.

apply plugin:'kotlin-android' apply plugin:'kotlin-android-extensions' dependencies { implementation "org.jetbrains.kotlin:kotlin-stdlib-jre7:$kotlin_version"}
3) A classpath was added to the p…