Controlling Display Refresh Rate on Android Device

前端 未结 2 477
星月不相逢
星月不相逢 2021-02-06 00:00

Not yet a developer, just trying to find out if an android app can do what I need..

What I need:

Simple app that displays a full frame of a sing

2条回答
  •  礼貌的吻别
    2021-02-06 00:34

    Mathias,

    So, if you want to synchronize with the display on android, simply let android tell you when the view needs to be drawn - which is the most basic thing one does on android. You will derive a class from the android provided View class. You will override the View classes onDraw() method which android will call each time the view needs to be refreshed.

    If you want to ensure that each frame you display is of a pre-determined length of time, then you will probably want to set up a new Thread. In the new thread you will enter a timing loop - start by capturing the System.nanoTime() (billionth of a second resolution) into a variable, then loop until your desired frame length is reached, then update a global static boolean variable. This global static boolean can be checked in your onDraw() method to determine when it is time to change the intensity.

提交回复
热议问题