Thursday, October 22, 2009

[android-developers] Re: Screen size

Be sure you read this so you understand what you are doing:


Also, go ahead and ignore my point that you shouldn't do things based on the raw physical dimensions of the screen, but your app will break in the future when it is running on some device that has status-bar like UI elements along the side of the screen.  You can pretty much count on this happening, especially as larger screens like MIDs etc appear.

On Thu, Oct 22, 2009 at 4:57 AM, Sikus <sikusradek@gmail.com> wrote:

So, I solved it. I have problem with manifest.xml. When I don't use
android:targetSdkVersion="4" it resize for example QVGA from 240x320
to 320x427 and WVGA from 480x800 to 320x533. When I use
android:targetSdkVersion="4" everithing works good and
Display display = ((WindowManager) getSystemService
(Context.WINDOW_SERVICE)).getDefaultDisplay();
display.getWidth();
display.getHeight();

return me correct absolute size of the physical screen. QWGA 240x320
like in Table 1 on http://d.android.com/guide/practices/screens_support.html#range

Now I need density too, so I use

DisplayMetrics metrics = new DisplayMetrics();
                getWindowManager().getDefaultDisplay().getMetrics(metrics);
                metrics.densityDpi;

it returns 120, 160 and 240 int number.




--
Dianne Hackborn
Android framework engineer
hackbod@android.com

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.


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

No comments:

Post a Comment