Tutorial by Examples

First, you'll need to install the Kotlin plugin. For Windows: Navigate to File → Settings → Plugins → Install JetBrains plugin For Mac: Navigate to Android Studio → Preferences → Plugins → Install JetBrains plugin And then search for and install Kotlin. You'll need to restart the IDE af...
You can create a New Project in Android Studio and then add Kotlin support to it or modify your existing project. To do it, you have to: Add dependency to a root gradle file - you have to add the dependency for kotlin-android plugin to a root build.gradle file. buildscript { repositorie...
Click to File → New → Kotlin Activity. Choose a type of the Activity. Select name and other parameter for the Activity. Finish. Final class could look like this: import android.support.v7.app.AppCompatActivity import android.os.Bundle class MainActivity : AppCompatActivity() { ...
Kotlin Plugin for Android Studio support converting existing Java files to Kotlin files. Choose a Java file and invoke action Convert Java File to Kotlin File:
fun startNewActivity(){ val intent: Intent = Intent(context, Activity::class.java) startActivity(intent) } You can add extras to the intent just like in Java. fun startNewActivityWithIntents(){ val intent: Intent = Intent(context, Activity::class.java) intent.putExtra(KEY_NA...

Page 1 of 1