https://kotlinlang.org logo
Title
u

user

07/12/2022, 10:11 PM
How to execute shell command in Kotlin and get return value from shell [Android] I am able to execute shell commands (that has a return value) in Kotlin [Android] using the following lines of code: fun getFrequencyLevelsCPU0(): Unit { val process: java.lang.Process = java.lang.Runtime.getRuntime().exec("su -c cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies") process.waitFor() } The above lines of code are capable of running the shell command but the output of the command should be something as follows if the command was...