I'm getting this error: java.lang.NoSuchMethodError: android.view.Display.getSize
How can I fix this?
This is my code:
Point p = new Point();
this.getWindowManager().getDefaultDisplay().getSize(p);
int screenWidth = p.x;
int screenHeight = p.y;
I'm getting this error: java.lang.NoSuchMethodError: android.view.Display.getSize
How can I fix this?
This is my code:
Point p = new Point();
this.getWindowManager().getDefaultDisplay().getSize(p);
int screenWidth = p.x;
int screenHeight = p.y;
getSize() method was added in API level 13. May be you are running your app on device with lower version than 13. Can you please validate this.
if you develop for API 12 or lower:
int screenWidth = this.getWindowManager().getDefaultDisplay().getWidth;
int screenHeight = this.getWindowManager().getDefaultDisplay().getHeight;
if you develop for api 13 or higher Maybe you should install the right SDK (in eclipse Windows > Android SDK Manager)