You don't need to do that work to find the size of the screen.  In the
activity, just getResources().getConfiguration(), and in the Configuration
object is the screen size along with many of the other resource
configurations.

On Mon, May 9, 2011 at 4:55 PM, Emanuel Moecklin <[email protected]>wrote:

> Not simple but doable:
>
> 1. Create an abstract custom view MyView with a method "public boolean
> isXLarge()"
> 2. Create two sub classes MyView1 and MyView2. MyView1 returns false
> in isXLarge(), MyView2 returns true.
> 3. Add MyView1 to the three portrait layouts (in layout-small, layout-
> normal and layout-large) and MyView2 to the landscape layout (in
> layout-xlarge)
> 4. In your activity get the MyView view (using findViewById) and check
> isXLarge(). If the method returns true then set the orientation of the
> activity to landscape, otherwise to portrait:
>    e.g.
> activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
>
> Emanuel Moecklin
> 1gravity LLC
>
> --
> 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
>



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