How to start a Activity of Kotlin from Java android

拈花ヽ惹草 提交于 2020-06-26 21:11:22

问题


Can I do this below prossess in android studio?

I have a Kotlin project that I create another activity with its Java class and I want to start activity of Kotlin with clicking botton in activity of java then it start Kotlin activity


回答1:


Kotlin is interoperable with Java. Just start the activity using an Intent like you would normally do in Java.




回答2:


Yes you can start activity from java to Kotlin and vice versa.

from java

startActivity(new Intent(context,DestinationActivity.class))

from kotlin

startActivity(Intent(this, DestinationActivity::class.java))


来源:https://stackoverflow.com/questions/56975424/how-to-start-a-activity-of-kotlin-from-java-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!