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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to