0

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"?

Perry
  • 116
  • 1
  • 1
  • 7

1 Answers1

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