I want to make a program for my Nexus 7 to check the status of my bootloader (with GUI). When typing fastboot devices, I get the s/n of my Nexus, this works well. But if I type fastboot getvar all (this is the bootloader-status) my programm freezes. When tping the command directly into the cmd-window, I get the correct output.
I've copied all files from the platform-tools-folder of the Android-SDK into my project-directory.
Here's some code:
The button which should do all the work:
- Code: Select all
JButton btnChckBl = new JButton("BL-Status");
btnChckBl.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
checkBlStatus();
}
});
btnChckBl.setBounds(425, 68, 89, 23);
contentPane.add(btnChckBl);
Here the method checkBlStatus():
- Code: Select all
public boolean checkBlStatus()
{
showStatus("fastboot getvar all");
String wholeText = txtStat.getText().toString();
if(wholeText.contains("unlocked")) {
lockState = true;
txtStat.setText(sBlUnlocked);
}
else {
lockState = false;
txtStat.setText(sBlLocked);
}
return lockState;
}
And here's showStatus():
- Code: Select all
public void showStatus(String command)
{
BufferedReader in = null;
try{
Process p = Runtime.getRuntime().exec(command);
InputStream s = p.getInputStream();
in = new BufferedReader(new InputStreamReader(s));
String temp;
while ((temp = in.readLine()) != null) {
txtStat.append(temp);
}
} catch (Exception e1) {
JOptionPane.showMessageDialog(null, sUnexp);
} finally {
if (in != null) {
try {
in.close();
} catch (IOException e1) {
JOptionPane.showMessageDialog(null, sIoexc);
} catch (Exception e2){
JOptionPane.showMessageDialog(null, sUnexp);
}
}
}
}
(txtStat is the status-window, it's a JTextArea)
I can't find a mistake, but maybe you can help me?

Thanks in advance


