I am able to get the frame rate of the Android system using the following answer in Java: https://stackoverflow.com/a/8908035/4190159
However, being new to Kotlin I was wondering how can I get the frame rate of Android system using Kotlin code? (my app is using Kotlin instead of Java)
The code as follows is not working for me:
fun getFrameRate(): String {
val timeElapsed1: android.os.SystemClock = SystemClock.elapsedRealtime()
val timeElapsed2: android.os.SystemClock = SystemClock.elapsedRealtime()
val frameTime = 1000.0 / (timeElapsed2 - timeElapsed1)
return frameTime
}