I have many layouts but I want to use the same landscape layout for all the Activities
without copying all the layouts in the landscape folder.
Is there a way to do this?
Asked
Active
Viewed 46 times
-1

joao2fast4u
- 6,868
- 5
- 28
- 42

user3398380
- 39
- 2
- 8
-
2Just use one layout for all activities...setContentView(R.layout.sameLayoutForAllActivities) – ElDuderino Apr 05 '14 at 20:33
-
I dont undestand how do that – user3398380 Apr 05 '14 at 20:42
-
Do you want to force all your activities to run in landscape mode? Is that it? – joao2fast4u Apr 05 '14 at 20:44
-
No, i have some different activities using different layouts , but if i turn the device landscape they must use the same layout – user3398380 Apr 05 '14 at 20:45
1 Answers
0
I solved that way
if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
setContentView(R.layout.oak);
}else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT){
setContentView(R.layout.activity_main);
}

user3398380
- 39
- 2
- 8