I have tried 2 approaches to find device dimensions (width and height):
getWindowManager().getDefaultDisplay();((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
But both these approaches are not reliable because at times they give me wrong dimensions. For HTC desire, which has 480×800 resolution, it would give me dimensions as 320×533, which are incorrect. Can someone please suggest a more reliable approach?
The following solution worked for me:
Along with following entry in manifest: