You should import your R
class, ie.:
import com.example.ping.R;
also make sure all your braces are properly closed, and finally:
whole your code block:
try {
Object host;
addr = InetAddress.getByName(host.toString());
InetAddress addr = null;
addr = InetAddress.getByName(host.toString());
} catch (UnknownHostException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
if(addr.isReachable(5000)) {
text.append("\n" + host + " - Respond OK");
} else {
text.append("\n" + host);
}
} catch (IOException e) {
text.append("\n" + e.toString());
}
}
is outside your method public void onClick(View v) {
:-)
and last hint, dont try do network operations on GUI thread, you will get exceptions, put it inside AsyncTask