0

I could not call java static function even after referring to Possibility to call a Java static method in Kotlin

I am new to Kotlin and Java, and i made a WearOS test code in kotlin.

import android.hardware.Sensor
import android.hardware.SensorEvent
import android.hardware.SensorEventListener
import android.hardware.SensorManager

....

class SensorActivity: Activity() {
    private var mSensor: Sensor? = null // import success

    ....
    
    fun myCode() {
        // i could not use getMaxLengthValuesArray
        val num = Sensor.getMaxLengthValuesArray(mSensor, sdkLevel);
    }
}

The getMaxLengthValuesArray is method of Sensor class which is declared in public and the method is also public static.

So i think i can access Sensor.getMaxLengthValuesArray according to the above ref Possibility to call a Java static method in Kotlin, but it does not work.

Is there something wrong with my understanding of Kotlin syntax?

Yuri Schimke
  • 12,435
  • 3
  • 35
  • 69
이준학
  • 31
  • 4

0 Answers0