Is there a way to show the average ping on android? I saw some tutorials but the most I got was this:
public void fExecutarPing(View view){
List<String> listaResponstaPing = new ArrayList<String>();
ArrayAdapter<String> adapterLista = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1,
listaResponstaPing);
try {
String cmdPing = "ping -c 4 " + 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){
listaResponstaPing.add(inputLinhe);
//adiciona para cada linha
listaPing.setAdapter(adapterLista);
}
} catch (Exception e) {
Toast.makeText(this, "Erro: "+e.getMessage().toString(), Toast.LENGTH_SHORT).show();
}
}
That shows the ping, along with the rest of the information. And what I need is to show only the average ping. How to do?