I should say -- I think this is better done by driving off what you can
retrieve with findViewById(), instead of duplicating your logic for which
layout you think you are using in code.  If you get to the point of thinking
about larger screens, you will probably have different decisions you make
about which layout to use there, and it is nice to be able to just set up
the resources to do the right thing without having to keep making
corresponding changes in your code.

On Wed, May 25, 2011 at 10:55 AM, Dianne Hackborn <[email protected]>wrote:

> Do findByViewId() and if it returns null you know you are in the
> orientation without that widget.
>
> Or if you really just want to know the orientation, use
> getResources().getConfiguration().orientation.
>
>
> On Wed, May 25, 2011 at 10:36 AM, Pikoh <[email protected]> wrote:
>
>> Thanks Treking for quick response (BTW you should get paid for this,
>> you are always here hehe :)
>>
>>  I think you are trying to tell me that i can create a /layout-port/
>> xx.xml and a /layout-land/xx.xml? I know that, but the problem is with
>> coding it. If the /layout-port/xx.xml has a ListView, but /layout-land/
>> xx.xml hasn't one, i think i need to know what the orientation is to
>> manage the correct views for not doing a findViewById(R.id.listview1)
>> in the layout-land. I'm sorry if i can't make myself understood with
>> this poor english :)
>>
>>  I see 2 solutions: 1) in the same activity asking what the device
>> orientation is and doing different tasks depending on that
>>                           2) when a screen orientation change
>> happens, calling another activity specifical for managing the
>> landscape layout
>>
>> Well, hope that made things clearer (although i won't bet on it)
>>
>>
>> On 25 mayo, 19:15, TreKing <[email protected]> wrote:
>> > On Wed, May 25, 2011 at 12:03 PM, Pikoh <[email protected]> wrote:
>> > >  Anyone can point me to the best way to do this? Thx
>> >
>> > http://developer.android.com/guide/topics/resources/providing-resourc.
>> ..
>> >
>> >
>> -------------------------------------------------------------------------------------------------
>> > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
>> > transit tracking app for Android-powered devices
>>
>> --
>> 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.
>
>


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