How do I listen for a response from shell command in android studio?
问题 In an android terminal emulator I can type the following commands: > su > echo $(</sys/class/power_supply/battery/charge_rate) and depending on how the phone is charging the output will be "None", "Normal" or "Turbo". I would like to be able to retrieve this output and store it as a string value in my program. So I've done a little bit of research into this and the code I came up with is as follows: String chargeRate = "None"; try { Runtime rt = Runtime.getRuntime(); Process process = rt.exec