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. sending an SMS and an e-mail.

I would like to make my app send an SMS or an e-mail based on a menu
item they select.

However, I would like to do this in a way that's not totally
automated.  When the user selects one of these options, it pre-fills a
bunch of data, and then allows the user to edit the content and select
the destination.

I think what I want to do is send an intent with a body of text/images
to send -- have the phone's app that normally does this pop up with
that content and ready to select a destination.

Can someone help me get started on doing this?


2. Newbie question - firmware version

Salam kenal buat semuanya,
Mo numpang tanya nih. Saya kan beli seken HTC dream singtel punya. Gimana ya
taunya kalo firmware yg dipake skr itu firmware ori buat Singtel dream?
Soalnya kan kayaknya saya nyari2 di google gak ada yg punya recovery
firmware aslinya singtel. So kalo udah pernah di-root, bisanya di-unroot ke
firmware UK atau US punya.
Pengen tanya soalnya pengen coba nge-root, tp takut garansi angus. Kalo udah
pernah di-root sebelumnya berarti kan emang dah angus, so gak perlu takut
Moga2 pertanyaannya jelas.

Google Groups "Indonesian Android Community [id-android]" group.

To post to this group, send email to id-android@googlegroups.com

To request to subscribe to this group, please visit the following page:

3. Porting Java app to Android--the basics

4. DDMS doesn't show process list on device

5. can I get XML information step by step using SaxParser??

6. Ku990

7. downgrade to 1.5