I'm trying to retrieve the output of commandOutput in order to pass it to another function, but commandCompleted is never ran. Any help?
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();
}
Your
commandCompleted(int id, int exitCode)implementation is missingcould it be the problem?
If you imported
RootToolsasyou could also be using
RootTools.Logwhich is muted by default. Maybe try to usejust to exclude the case.