赞
踩
- public void shellExec() {
- Runtime mRuntime = Runtime.getRuntime();
- try {
- //Process中封装了返回的结果和执行错误的结果
- Process mProcess = mRuntime.exec("adb version");
- BufferedReader mReader = new BufferedReader(new InputStreamReader(mProcess.getInputStream()));
- StringBuffer mRespBuff = new StringBuffer();
- char[] buff = new char[1024];
- int ch = 0;
- while ((ch = mReader.read(buff)) != -1) {
- mRespBuff.append(buff, 0, ch);
- }
- mReader.close();
- System.out.print(mRespBuff.toString());
- } catch (IOException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。