Techiio-author
Started by Debarghya DasSep 14, 2021

Open
Android use java & kotlin for develop, but when kotlin pass a java object to another kotlin function, it did'n print exception but just stoped

0 VIEWES 0 LIKES 0 DISLIKES SHARE
0 LIKES 0 DISLIKES 0 VIEWES SHARE

the code is below kotlin part:

if (isMainPage(infos, loaderInfo.pageUri)) {
return
}

the loaderInfo.pageUri is java code like this:

   public String getPageUri() {
return pageUri;
}

the isMainPage function is like this:

private fun isMainPage(infos: Info, pageUri: String): Boolean {

when this method is called. pageUri is empty,The thread just dies without printing any exception messages in the logcat.And it took a long time to debug why. Is there any way it can print a NullPointerException?There are many scenarios where Java and Kotlin call each other. anyone can help, thanks a lot.

I know I can change the isMainPage with pageUri:String? to prevent this problem, i just want to know why it did't print any message when exception occurs.

0 Replies

You must be Logged in to reply
Techiio-logo

Techiio is on the journey to build an ocean of technical knowledge, scouring the emerging stars in process and proffering them to the corporate world.

Follow us on:

Subscribe to get latest updates

You can unsubscribe anytime from getting updates from us
Developed and maintained by Wikiance
Developed and maintained by Wikiance