Refactoring and cleanup

To have the best possible code after conversion, we must perform refactoring and cleanup. We will adapt our code base to conform Kotlin standards and idioms. For that purpose, you must read it whole. Only when this is done, we can consider our migration done!

Open your classes and read the code. There is a lot of space for improvements! After you do some work, you should get something like this:

The MigrationActivity code is as follows:

    ... 
    override fun onResume() = super.onResume() 
    ... 

As you can see, there is not too much work for MigrationActivity (and MigrationActivity2). Both classes are really small. A bigger effort is expected for classes such as Dummy and Dummy2:

  • The Dummy class code is as follows:
 package ...

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.