I have four different layout (same name) in different folder for different screen size . every layouts have some TextView and ImageView and one button with the same value ! i want to know they should have same id ? for example all buttons in four layouts should have same id ? i want to use them in my MainActivity.java
Asked
Active
Viewed 46 times
2 Answers
0
Yes. because you are calling the same layouts(although they are for different screen sizes), but they have the same features.

Kyle Emmanuel
- 2,193
- 1
- 15
- 22
-
same features like what ? – user2549089 Jul 19 '14 at 07:04
-
TextView, ImageView, and one button. – Kyle Emmanuel Jul 19 '14 at 07:06
0
Hi you have to use the same id.Because for different screen sizes only you made your layout with different UI changes. If you does not follow the same id,you will get NPE exception when you trying to execute in different screens/devices.
So the id must be same in all four layouts which in different folder.
Thanks

micky
- 508
- 5
- 17
-
-
ofcourse!!you have to make design alignment for different screen sizes... – micky Jul 19 '14 at 07:10
-
i just change the size or height in new layout (enough for me) ! what should i do else ? – user2549089 Jul 19 '14 at 07:17
-
What is yout problem exactly?You want to use the same id for all different layouts...For every layout you are going to use single activity right..You your id must be same...If you want your app to be compatible to all screens pls refer http://developer.android.com/guide/topics/manifest/supports-screens-element.html – micky Jul 19 '14 at 07:22