Note that this returns the raw size of the screen, not taking into account
decorations around it like the status bar or IME that impact the available
space to the app.

Apps should almost always be using the view hierarchy's layout system to
take care of their size.  That is, View.onSizeChanged() and the APIs on View
to get its current width/height.

On Mon, Apr 12, 2010 at 6:01 PM, murali raju <[email protected]> wrote:

> DisplayMetrics dis = new DisplayMetrics();
>        getWindowManager().getDefaultDisplay().getMetrics(dis);
>
>        Log.i("width = ",""+ (width = dis.widthPixels));
>        Log.i("height = ",""+ (height = dis.heightPixels));
>
>
>
> On Tue, Apr 13, 2010 at 3:35 AM, Bob <[email protected]> wrote:
>
>> Hi,
>> I need to know how many pixels wide and tall the screen is.  I know
>> that there are a bunch of different localization folders that I could
>> make for different views but I just need to know, programmatically,
>> how many pixels are on the screen so I can do some drawing.  How can I
>> detect this?
>>
>> Thanks,
>> Bob
>>
>> --
>> 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
>>
>> To unsubscribe, reply using "remove me" as the subject.
>>
>
>  --
> 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
>



-- 
Dianne Hackborn
Android framework engineer
[email protected]

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 [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