Do you have targetSdk set correctly? It seems like your app runs in
compatibility mode, and sees emulated HVGA display parameters.

--
Kostya Vasilyev -- http://kmansoft.wordpress.com

23.08.2010 17:51 пользователь "Alok Kulkarni" <[email protected]> написал:

Hi all,
I want to get the width and height of my device to know what type device it
is ie QVGA, HVGA ,WVGA.. Also i need to adjust some layouts according to
width and height of the screen.
I tried following methods but its not working.

1)

   1. /* First, get the Display from the WindowManager */
   2.
   Display display = ((WindowManager)
getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
   3.
   4. /* Now we can retrieve all display-related infos */
   5. int width = display.getWidth();
   6. int height = display.getHeight();
   7. int orientation = display.getOrientation();

2)
width = getResources().getDisplayMetrics().widthPixels;
height = getResources().getDisplayMetrics().heightPixels;


3)

int ht;

int wt;

DisplayMetrics displaymetrics = new DisplayMetrics();

getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);

ht = displaymetrics.heightPixels;

wt = displaymetrics.widthPixels;


All these methods return wrong width and height for the 240x320 devices
namely Samsung Europa and Alcatel which i have.
Width = 320
Height = 240.. This is wierd as some of the critical functionality is
getting hampered .. I think this is really a basic thing which shd be
correctly provided. Please help me with this issue .
Thanks,
Alok


 --
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]<android-developers%[email protected]>
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to