Check status of bootloader

Put your problem here if it does not fit any of the other categories.

Check status of bootloader

Postby Murb » Thu Aug 23, 2012 5:15 pm

Hi all,

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
Murb
Freshman
Freshman
 
Posts: 3
Joined: Thu Aug 23, 2012 5:12 pm

Top

Re: Check status of bootloader

Postby Murb » Fri Aug 24, 2012 10:50 pm

Nobody? :shock:
Murb
Freshman
Freshman
 
Posts: 3
Joined: Thu Aug 23, 2012 5:12 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 17 guests