Converting code from Java to Kotlin in Android Studio

Flugrek picture Flugrek · Nov 3, 2017 · Viewed 12.6k times · Source

Can anyone explain how to replace existing Java code with Kotlin within Android Studio?

Answer

lase picture lase · Nov 3, 2017

If you've got Kotlin already configured in your Android Studio project, you can follow the steps outlined here to automatically convert with the instructions here.

From the site:

  • On the main menu, point to Code menu.
  • Choose Convert Java File to Kotlin File.