问题
Process p = Runtime.getRuntime().exec("screencap -p /storage/sdcard0/test3332.png");
p.waitFor();
String error = "error: " + p.exitValue();
p.exitValue()
is equal to 11
How to get the "meaning" or message from this exit code?
If this should be available in the command's manual, then where to find this manual? Can someone post a link or a reference ?
回答1:
The error message can be retrieved in this way:
int ch;
StringBuilder sb = new StringBuilder();
while((ch = p.getErrorStream().read()) != -1) {
sb.append((char)ch);
}
String errorString = sb.toString();
Log.d("TAG", "Error is: " + errorString);
来源:https://stackoverflow.com/questions/64844158/where-to-lookup-for-the-meaning-adb-screencap-commands-exit-codes-or-how-to-g