2

recently I study kotlin. first, kotlin is not support static.

so I use companion object

companion object InstanceHolder {
   private val mCamera = MainActivity()

   fun getInstance(): MainActivity {
       return mCamera
   }
}

but I want this source convert to java. How to convert kotlin to java?

thanks

hyunwookcho
  • 127
  • 1
  • 1
  • 12

1 Answers1

0

in IntelliJ or Android Studio, you just have to do the following to get java code from kotlin:

Menu > Tools > Kotlin > Show Kotlin Bytecode Click on the Decompile button Copy the java code

Refer this answer in stackoverflow Convert Kotlin to Java

Nilesh Panchal
  • 981
  • 1
  • 7
  • 23