Hello,
I'm new to android and I am working on an application of which the layout changes when the orientation of the screen changes.
In landscape mode I want to show data using layout x and in portrait mode using layout y (with different widgets in it).
It seems there are 2 ways to achieve this.
1. I understand that an activity is destroyed and recreated when the orientation changes. Than I can detect the orientation in the onCreate method and set the contentview to the appropriate layoutview and it works.
2. Second possibility is using the onConfigChanges method which is called when the configuration changes. In this case I would create the 2 views in the onCreate method when the activity starts for the first time. And when onConfigChanges is called I can set the contentview to the appropriate view with setContentView().
I'm not really sure which of these 2 is the best way to make it work.
Any suggestions?
Thank you.




