I have a date/time picker which I want them to react according based on its layout.
Consider on landscape mode:
This is a perfect placement of what I
When screen orientation change than activity again recreated so do this :
int orientation = this.getResources().getConfiguration().orientation;
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
//code for portrait mode
} else {
//code for landscape mode
}
Happy coding!!
You can create a layout-land directory that contains landscape layouts of your screens. In this case you would place the original layout inside the layout-land directory and place the orientation:vertical
layout inside your layout folder.
The Android documentation has information on how to support different screens