Converting classes

Finally, we will migrate our classes. We have two automatic options available. We will use both. Locate and open it. Choose the Code | Convert Java file to the Kotlin file. It takes a couple of seconds to convert. Now, drag and drop the file from the Java package into the Kotlin sources package. Observe the following source code:

    package com.journaler.activity 
    import android.os.Bundle 
    import com.journaler.R 
    class MigrationActivity : AppCompatActivity() { 
      override fun onCreate(savedInstanceState: Bundle?) { 
      override fun onResume() { 

As we have mentioned, ...

Get Mastering Android Development with Kotlin now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.