android获取ping IP的fps

p = Runtime.getRuntime().exec("ping -c 4 -w 20 " + serverIp);
int status = p.waitFor();
if (status == 0) {
    BufferedReader buf = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String str = new String();
    while ((str = buf.readLine()) != null) {
        if (str.contains("avg")) {
            int i = str.indexOf("/", 20);
            int j = str.indexOf(".", i);
            delay = str.substring(i + 1, j);
        }
    }
    Log.d("look_fps", delay);
}

猜你喜欢

转载自blog.csdn.net/androidisgod/article/details/103944277
FPS