Life is good and everything will be ok, Kotlin is here…

In this article we will check how we can start with Kotlin for Android.

Make sure you won’t overwrite your old Android Studio when you install the new version.

Method 1 :

First you have to download Android Studio Beta 3.0 from here.

Android Studio has support for Kotlin. Go to Create Android Project. You will see new thing there: Checkbox with label include Kotlin support. It is checked by default. Press next twice and select Empty Activity, then finish.

package com.coderzheaven.kotlin_demo

import android.os.Bundle

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {

.kt is the extension for Kotlin Files.

? in savedInstanceState: Bundle? ? It means that savedInstanceState parameter can be Bundle type or null. Kotlin is null safety language that means in Kotlin, you will never see the famous Null Pointer Exception.

Method 2 :

You can install Kotlin Plugin for Android Studio.

Go to Preferences -> Plugins -> Search for Kotlin and install.
Then Restart the Android Studio and there you are.
You are now ready with Kotlin.


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.