使用RootTools从已完成的命令返回输出

时间:2015-09-26 17:06:20

标签: java roottools

我正在尝试检索commandOutput的输出以便将其传递给另一个函数,但是commandCompleted从未运行过。有什么帮助吗?

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();
}

1 个答案:

答案 0 :(得分:0)

您的$scope.getPhotos = function(){ if($scope.identification){ flng = angular.copy($scope.identification.following); flng.push($scope.identification.username); var data = {username: $scope.identification.username, token: $scope.identification.token, following: flng} //IDENTIFICATION HAS ALL THE INFO. $http.get('/users/getphotos', data).success(function(response){ $scope.photos = response; }); } } 实施缺失

commandCompleted(int id, int exitCode)

可能是问题吗?

如果您将super.commandCompleted(id, exitCode); 导入为

RootTools

您也可以使用默认为静音的import com.stericson.RootTools.*; 。也许尝试使用

RootTools.Log

只是为了排除案例。