It is entirely possibly to have resources and code vary based on
orientation, but the code you have here is fundamentally broken: landscape
!= tablet, portrait != phone.

This document talks about identifying tablets vs phones:
http://android-developers.blogspot.com/2011/07/new-tools-for-managing-screen-sizes.html

2011/9/18 Károly Holczhauser <[email protected]>

> I have to load different layouts for activities depending on the
> device type, not only menus :(
> Okay, I see there are alternative resources, but how can I handle this
> on the level of activites?
> if(orientation== landscape){
> init tablet varables
> }else{
> phone variables
> }
>
> This is what I would like not to do, I looking for some more elegant
> solution !
>
> On Sep 16, 10:49 am, sparky <[email protected]> wrote:
> > Please don't use multiple APKs for tablet support. Just implement some
> > xlarge layouts.  You'll be glad you did.  For the menu buttons, just
> > populate the Activity Bar with Options Menu items.  Any buttons that
> don't
> > fit on screen can automatically go into the Options (or overflow) menu.
> >
> > See this article:
> http://developer.android.com/guide/practices/optimizing-for-3.0.html --
> > although it says 3.0, it's mostly about adding support for tablets.
>
> --
> 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