I have two different layouts for two different Activities. There is a button in each of these layouts with the same id: \"@+id/btnOK\". When I set a property for one of thes
On the "Duplicate Ids in layouts" topic, extracted from android developers
Defining IDs for view objects is important when creating a RelativeLayout. In a relative layout, sibling views can define their layout relative to another sibling view, which is referenced by the unique ID.
An ID need not be unique throughout the entire tree, but it should be unique within the part of the tree you are searching (which may often be the entire tree, so it's best to be completely unique when possible).
Which means different layouts may declare identical IDs, tho it's not a best practice.