I am writing a livewallpaper. As before, I get the user's screen width & height at "onSurfaceChanged". Can I get the screen width & height at "onSurfaceCreated"?
Asked
Active
Viewed 75 times
1 Answers
2
you can get screen size at anywhere you like using
getWallpaperDesiredMinimumWidth()/2
or put
WindowManager wm = (WindowManager)getSystemService(WINDOW_SERVICE);
DisplayMetrics metrics;
disp = wm.getDefaultDisplay();
at the top of the source, and do
disp.getMetrics(metrics);
screenWidth = (float) metrics.widthPixels;

yokko445
- 23
- 1
- 6