问题小结(10)-android中ping命令的实现public static String pingHost(String str){String resault="";try {// TODO: Hardcoded for now, make it UI configurableProcess p = Runtime.getRuntime().exec("ping -c 1 -w 100 " +str);int status = p.waitFor();if (status == 0) {//mTextView.setText("success") ;resault="success";} else{resault="faild";//mTextView.setText("fail");}} catch (IOException e) {//mTextView.setText("Fail: IOException"+"\n");} catch (InterruptedException e) {//mTextView.setText("Fail: InterruptedException"+"\n");}return resault;}方法的参数是你要ping的目标地址。