Skip to content

Instantly share code, notes, and snippets.

@rms1000watt
Last active May 31, 2016 23:20
Show Gist options
  • Save rms1000watt/9f8f0545548d7645c439697640382116 to your computer and use it in GitHub Desktop.
Save rms1000watt/9f8f0545548d7645c439697640382116 to your computer and use it in GitHub Desktop.
Execute OS command on Android
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