I have two layouts, main.xml and it has a viewstub element and hidden.xml. the setContentView is set main.xml.
And In both of the layouts, there is an edittext with @+id/latEt. After I inflated the main.xml with hidden.xml how can I refer to each edittext individually? Or, I have to simply change the id of each edittext?
I agree that it's not recommended to have the same ID on more than one view, however sometimes it's unavoidable. In that case, as long as the two views are not direct children of the same viewgroup, you can use findViewById on their respected viewgroup.
For example when you inflate the stub you usually have a reference the newly inflated View - simply call findViewById on that view and you're guaranteed to get the view that's in that inflated stub and not the other one.