How to access Kotlin companion object in Java?

前端 未结 4 1550
谎友^
谎友^ 2021-01-07 15:58

I convert one of my Java class to Kotlin and the class as below.

class MainApplication : Application() {
    companion object {
        operator fun get(cont         


        
4条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-07 16:40

    Ops, I got it. Just use the below.

    MainApplication application = MainApplication.Companion.get(mContext);
    

提交回复
热议问题