Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedReader; import java.io.DataOutputStream; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void changeAirplaneOff() { /* settings put global airplane_mode_on 0 am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false */ do_exec_with_root("settings put global airplane_mode_on 0"); do_exec_with_root("am broadcast -a android.intent.action.AIRPLANE_MODE --ez state false"); } public static String do_exec_with_root(String cmd) { String s = "\n"; try { Process su_p = Runtime.getRuntime().exec("su"); DataOutputStream dataOutputStream = new DataOutputStream(su_p.getOutputStream()); dataOutputStream.writeBytes(cmd + "\n"); dataOutputStream.writeBytes("exit" + "\n"); dataOutputStream.flush(); BufferedReader in = new BufferedReader(new InputStreamReader(su_p.getInputStream())); String line = null; while ((line = in.readLine()) != null) { s += line + "\n"; } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return s; } }