Android: How to use screen orientation change to switch between activities?

You don't have to write any code - Android already handles this automatically Just create two different layout resource folders.

You don't have to write any code - Android already handles this automatically. Just create two different layout resource folders: /res/layout-land // layout resources for landscape /res/layout-port // portrait layout Put in this folders xyz. Xml resource description files with the same name and different content.

One using activities for portrait, the other for landscape. Note that you can use the same technique (-port & -land qualifiers) for drawables (bitmaps) or any other resources (text). Note: this is not supported on Android 1.5.If you want to support this version you must additionally add the /res/layout folder.

I know about that. But I don't know how to start an activity out of a layout file. The normal way is to load the layout at runtime with setContentView().

But as one activity is tabbed and thus a TabActivity even this won't work, as TabActivity has no setContentView() function. I guess my problem is the TabActivity. Maybe it is possible in the Manifest.

Xml file to make two entry points, one for portrait and one for landscape? – Darokthar Nov 12 '10 at 18:21 1 Look @CommonsWare comment above: you do not need TabActivity to create tabs. – Peter Knego Nov 12 '10 at 18:30.

If you still want to use the advantages of TabActivity when using tabs in portrait mode, while not having tabs in landscape mode, you could use the following (ugly but still working) workaround. Create /res/layout-land folder and put there a corresponding layout file (it should have the same name that the file in layout folder, you use for portrait orientation). This file, however, should contain the blocks required by the TabActivity to work.

That is fine, add those blocks and set their visibility to "gone", like in the following snippet: Of course, make sure you handle the content management correctly in your activity class, depending on the orientation.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions