So is it that of API level is 3, then it wont calculate the width and height
and just assume the emulated HVGA version as 320 x 427.. But what is 427 i
mean it shd be 480 rite ??

2010/8/23 Alok Kulkarni <[email protected]>

> Ok.. here is what the case is..
> I have <uses-sdk android:minSdkVersion="3" /> in manifest, but i compile
> the project using Android 2.1 as i have to support few APIs for contacts
> introduced in 2.1..
> So my app is compiled against 2.1 but runs for Android 1.5 as well.
>
>
> 2010/8/23 Kostya Vasilyev <[email protected]>
>
> 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]<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