Right click to open menu
Android Development using Kotlin

Menu bar

Quick Actions

Ribbon

Insert:
Error: Internet connection appears to be offline (0)

Outline

Android Development Using KotlinLink to heading
Hello Android Using Kotlin And Android StudioLink to heading
Step 1: Install Kotlin Plugin, Then Restart Android StudioLink to heading
Step 2: Create A New Android Studio Project With A Blank ActivityLink to heading
Step 3: Open Main Activity And Delete Everything In The File Except OncreateLink to heading
Step 4: Rename Java Dir To KotlinLink to heading
Step 5: Convert Java Activity File To KotlinLink to heading
Step 6: Change Oncreate's Argument From Bundle To Bundle? (I.e. Nullable) In The Generated FileLink to heading
Step 7: Convert Project To Kotlin (This Modifies Build.gradle)Link to heading
Step 8: Select V0.8.11Link to heading
Step 9: Compile Project. Now Are You Good To Go.Link to heading

Document

Android Development using Kotlin
Empty Image
Kotlin is clean and elegant
when (stream) {
    is Reader -> stream.close()
    is Writer -> stream.close()
    is InputStream -> stream.close()
    is OutputStream -> stream.close()
    is Socket -> stream.close()
    else -> System.err.println("Unable to close object: " + stream)
}
Kotlin is expressive
val people = hashMapOf<String, Int>()

for ((person, age) in  people) {
  println("${person} in ${age} years old")
}
Functions are very powerful
fun Int.abs() : Int = if (this >= 0) this else -this
Fore more details about Kotlin, visit http://kotlinlang.org/

Hello Android using Kotlin and Android Studio
This tutorial is based on:
  • Android Studio (Beta) v0.8.2
  • Kotlin Plugin 0.8.11
Step 1: Install Kotlin plugin, then restart Android studio
Empty Image
Empty Image
Empty Image
Empty Image
Empty Image
Empty Image
Empty Image
Step 2: create a new Android studio project with a blank activity
Empty Image
Empty Image
Empty Image
Empty Image
Empty Image
Step 3: Open main Activity and delete everything in the file except oncreate
Empty Image
Step 4: Rename java dir to kotlin
Empty Image
Empty Image
Step 5: convert java activity file to kotlin
Empty Image
Step 6: change oncreate's argument from bundle to bundle? (i.e. nullable) in the generated file
Empty Image
Step 7: convert project to kotlin (this modifies build.gradle)
Empty Image
Step 8: select v0.8.11
Empty Image
Empty Image
Step 9: Compile project. Now are you good to go.
Empty Image