if-else布尔类型不工作在Android中

时间:2014-02-16 02:26:47

标签: android if-statement

请帮帮我。 我尝试确定设备是否被ROOT:

  private static boolean isRooted() {
        return findBinary("su");

    }



    public static boolean findBinary(String binaryName) {
        boolean found = false;
        if (!found) {
            String[] places = {"/sbin/", "/system/bin/", "/system/xbin/", "/data/local/xbin/",
                    "/data/local/bin/", "/system/sd/xbin/", "/system/bin/failsafe/", "/data/local/"};
            for (String where : places) {
                if ( new File( where + binaryName ).exists() ) {
                    found = true;
                    break;
                }
            }
              }
        return found;
    }

然后在其他函数上我使用if-else:

 if(isRooted() == true){
String st1="Device is ROOTED"; 
ltextview.setText(st1);
} else {
String st1="Devive is NOT ROOTED"; 
ltextview.setText(st1); }

稍后在代码中我打印Strings ... 但它没有正常工作。 :(((

0 个答案:

没有答案