Parameter specified as non-null is null for data in onActivityResult

Recently, using kotlin combined with zxing development, I found some problems:

If a null value is returned, an error of Parameter specified as non-null is null for data will be reported in onActivityResult. This problem does not occur in java. The reason is that kotlin has a non-null check. If you directly use the java source code of onActivityResult to convert to kotlin, you will find that

override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {}

 There is one less question mark in data:Intent, just add ? That's it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326115024&siteId=291194637