On Tue, Mar 29, 2011 at 2:11 PM, Wall-E <[email protected]> wrote:
> So I already have my resource file in the layout-land folder.  I guess
> the clarification I need is, how does the activity know to use that
> resource file?
>
> Do I name it the same thing and in my main layout
> folder?

Yes. If you have the default version in res/layout/main.xml, a
landscape version to override the default would go in
res/layout-land/main.xml.

> But... now when I run it on my device and change orientation I
> don't see the same changes.

Of course not. You specifically told Android not to perform any
changes, by using android:configChanges. If you want Android to
automatically apply the changes, by destroying and recreating your
activity, get rid of android:configChanges. Otherwise, you have to
make whatever changes you want in Java code.

Which is why you should not write your activities the way you did.
android:configChanges is to be used in fairly limited cases, and
there's nothing in either of your posts that suggests that your
activity fits one of those cases (e.g., uses a WebView, uses a
Camera).

> Any other hints?

Use onSaveInstanceState() and onRetainNonConfigurationInstance() to
pass data to the new activity from the old one, after you get rid of
android:configChanges.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version
1.9.2 Available!

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