关于ping 和消息回现
mBtnAction = (Button)findViewById(R.id.BTN_ACTION);
mTxtContents = (EditText)findViewById(R.id.TXT_CONTENTS);
mBtnAction.setOnClickListener(this);
private void doAction() {
try {
Runtime runtime = Runtime.getRuntime();
System.out.println("hello");
Process proc = runtime.exec("ping fr.yahoo.com -c 1"); // other servers, for example
proc.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
private void printText(String text) {
mTxtContents.append(text);
mTxtContents.append("\n");
}
如何将ping的结果回现到 TxtContents里面?
点击按钮后无响应?
求助