Display.getRefreshRate() giving me different values in different devices
I'm using Display.getRe开发者_开发知识库freshRate() to retrieve the refresh rate of my display. In an X10 Mini, the value returned is 0.325. In a Galaxy S, the value is 68.0. This doesn't make any sense to me. Any ideas?
This appears to be a bug, though I haven't found any bug reports for it. The number I get out is also ~0.34, while I was expecting something like 60. I havent managed to find a meaningfull interpretation of 0.34 with regard to refreshrates, and so my solution was simply to "reject its truth and substitute my own" with the following code:
public float getRefreshRate() {
final WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
final Display display = wm.getDefaultDisplay();
float rate = display.getRefreshRate();
if (rate < 10.0f) {
rate = 60.0f; //Default to something which seems to be a normal refreshrate on many phones
}
return rate;
}
This works great in my app. Hope this was helpfull!
精彩评论