try {
Process process = Runtime.getRuntime().exec("su");
java.io.DataOutputStream os = new java.io.DataOutputStream(process.getOutputStream());
os.writeBytes("id\n");
os.writeBytes("exit\n");
os.flush();
process.waitFor();
boolean hasRoot = process.exitValue() == 0;
textview1.setText(hasRoot ? "ROOT OK" : "NO ROOT");
} catch (Exception e) {
textview1.setText("ERROR");
}