Last active
May 31, 2016 23:20
-
-
Save rms1000watt/9f8f0545548d7645c439697640382116 to your computer and use it in GitHub Desktop.
Execute OS command on Android
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.util.Log; | |
import java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
private void executeCommand() { | |
String inputLine; | |
String output = ""; | |
Process process = Runtime.getRuntime().exec("cat /proc/net/xt_qtaguid/stats"); | |
BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream())); | |
while ((inputLine = in.readLine()) != null) { | |
output += inputLine + '\n'; | |
} | |
in.close(); | |
process.waitFor(); | |
process.destroy(); | |
Log.i("Output", output); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment