Devices with Ice Cream Sandwich can use on-screen soft keys, and this means that some of the screen estate is taken by these keys. I need to get the real screen resolution,
From API level 17 (Android 4.2 Jelly Bean), you can get the real size of the display as follows:
Point size = new Point();
Display display = getWindowManager().getDefaultDisplay();
display.getRealSize(size);
size
will now contain the display size based on the orientation (ie. x will be left/right relative to the user, not the device)