//所有的adb command需要以空白來分隔為String[].
//Example : String csCmd = "ifconfig 192.168.0.1";
// String[] csAdbCmd = csCmd.split(" ");
String[] csAdbCmd = {"ifconfig", "192.168.0,.1"};
String strNetCfg = "";
ProcessBuilder processBuilder = new ProcessBuilder(csAdbCmd});
try{
Process netcfg = processBuilder.start();
netcfg.waitFor();
DataInputStream dis = new DataInputStream(new BufferedInputStream(netcfg.getInputStream()));
while((strNetCfg = dis.read
Line()) != null){
//adb return value
}
}
catch(IOException e)
{
//do something
}
catch (InterruptedException e) {
//do something
}