I used followng ways to get the width and height of the screen. When I run my application in motorola, I got width = 320pixel and height = 533 pixels. But the size of the motorla mark is 480 x 854 pixels. How to get a height like 854 and a width of 480 cm. Http://www.gsmarena.com/motorola_milestone-3001.php
Display display = getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height = display.getHeight(); DisplayMetrics metrics = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(metrics); int heightOfScreen = metrics.heightPixels; int widthOfScreen = metrics.widthPixels; System.out.println("...w1..."+width+"...h1..."+height+"....w2...."+widthOfScreen+"...h2..."+heightOfScreen);
Output w 1 = 320 ... h1 = 533 ... w2 = 320 ... h2 = 533
user831722
source share