0
我試圖檢索commandOutput的輸出以便將它傳遞給另一個函數,但commandCompleted從不運行。任何幫助?使用RootTools從完成的命令返回輸出
Command command = new Command(0, "cat " + file){
private String output;
@Override
public void commandCompleted(int id, int exitCode) {
Log.d("Commands.Completed", output);
Log.d("Commands.Completed", "ID: " + id + " & exitCode: " + exitCode);
saveData(output);
}
@Override
public void commandOutput(int id, String line) {
output += line + "\n";
}
@Override
public void commandTerminated(int id, String reason) {
}
};
try {
RootTools.getShell(true).add(command);
} catch (IOException | RootDeniedException | TimeoutException e) {
e.printStackTrace();
}