DisplayMetrics issue on Android1.6 SDK

by lianwei » Sat, 19 Sep 2009 18:02:08 GMT

Sponsored Links
 I got a issue with DisplayMetrics.

  DisplayMetrics dm = new DisplayMetrics();
  Log.d("TEST", dm.widthPixels + "x" + dm.heightPixels);

If I do not specify the <uses-sdk android:minSdkVersion="4" /> or
<supports-screens android:anyDensity="true"></supports-screens>, then
the value of dm.widthPixels and heightPixels is wrong on QVGA and WVGA
screen. e.g. on QVGA, the return value is 320x427.

If this is a bug on Android1.6 SDK?

For chinese users, please see  http://easyandroid.com/bbs/viewthread.php?tid=19 

DisplayMetrics issue on Android1.6 SDK

by Dianne Hackborn » Sun, 20 Sep 2009 01:31:47 GMT

 That is intentional.  If you haven't said you support other densities than
the framework runs you in a compatibility mode to make it look like you are
on a medium density device.  By saying that you work with SDK 4, you are
also implying that you understand how to deal with densities.

Dianne Hackborn
Android framework engineer

Note: please don't send private questions to me, as I don't have time to
provide private support, and so won't reply to such e-mails.  All such
questions should be posted on public forums, where I and others can see and
answer them.


Sponsored Links

Other Threads

1. method.getAnnotation( ) or method.isAnnotationPresent( ) not working

Just wanted to add that I get false for following line even if I have
annotation added.
if (methodList[i].isAnnotationPresent(MethodInfo.class))


2. Mod, WTS: Pre Order Motorola Droid

1.Setiap posting WTS jangan sertakan barang yg sold out

2.Posting WTS hanya boleh sekali dalam hari jualan

3.Peringatan terakhir


Agus Hamonangan

3. new interpreter for Android

4. Removing Calendar package

5. implementing predictions for IME?

6. How to use TCP transport in android rtsp client.

7. Box2D on Android via JNI