0

In my app, I used handle.postDealy(Runnable, 50) to refresh my View. but sometimes it was very not precise. it was be 90ms. here are the log:

onRender interval: 86

onRender interval: 90

onRender interval: 84

onRender interval: 90

how can I get the precise timer in android? Do VSync i can use?

    if( mHandler != null){

        if (System.currentTimeMillis() - interval > 60){
            Log.d(TAG, "onRender interval: " + (System.currentTimeMillis() - interval));

        }

        mRenderCallback.onRender();
        mHandler.postDelayed(this, 50);
        interval = System.currentTimeMillis();
    }

1 Answers1

-1

Sometimes Handler postDelay not working precise. for that you can use Timer class not CountDownTimer class use only Timer class and set Delay time in Timer class Method.