Android
4
Вклад в тег
private void runCmdWithProgress(String... args) throws IOException {
Process proc = Runtime.getRuntime().exec(args);
InputStream inputStream = proc.getErrorStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String s = null;
while ((s = bufferedReader.readLine()) != null) {
Double progress = Double.parseDouble(s.split("%")[0]) / 100;
Platform.runLater(() -> tab_adb_progressbar.setProgress(progress));
}
try {
proc.waitFor();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
new Thread(() -> {
try {
runCmdWithProgress(commands);
Platform.runLater(() -> showDialogInformation(positive);
} catch (IOException e) {
e.printStackTrace();
}
}).start();