title: How do I programmatically ping a website in Android
body: <p>I trying to make an app that can get ping of websites or ip address and show just ping number in a textview,im using this code for get ping:</p>
  
  <pre><code>public void fExecutarPing(View view){
          Editable host = edtIP.getText();
  
  
      try {
          String cmdPing = "ping -c 1 -w 1 "+host;
          Runtime r = Runtime.getRuntime();
          Process p = r.exec(cmdPing);
          BufferedReader in = new BufferedReader( new InputStreamReader(p.getInputStream()));
          String inputLinhe;
  
  
          while((inputLinhe = in.readLine())!= null){
  
              Toast.makeText(this, inputLinhe, Toast.LENGTH_SHORT).show();
  
          }
  
  
      } catch (Exception e) {
          Toast.makeText(this, "Error: "+e.getMessage().toString(), Toast.LENGTH_SHORT).show();
  
      }
  </code></pre>
  
  <p>this code just give me multi toast message like when you pinging in windows Command, but how can i just get ping number for example: 85</p>