Re: [android-developers] Are Layouts Reusable?

2012-11-01 Thread Mark Phillips
Thanks, that clears up my confusion. Mark On Wed, Oct 31, 2012 at 2:01 PM, nEx.Software email.nex.softw...@gmail.comwrote: You can have many instances of any type of View with the same id without restriction. The id is just an int field on a view, so that the view may be identified in code.

Re: [android-developers] Are Layouts Reusable?

2012-10-31 Thread lbendlin
I would think that the view IDs are bound to the activity or fragment where they are inflated in. But the best thing for you is to actually try it out and see for yourself. On Tuesday, October 30, 2012 8:12:06 PM UTC-4, Mark Phillips wrote: Thanks for your response. What happens to the ids

Re: [android-developers] Are Layouts Reusable?

2012-10-31 Thread nEx.Software
You can have many instances of any type of View with the same id without restriction. The id is just an int field on a view, so that the view may be identified in code. Changes to one instance will not change the other instances, regardless of their container (Activity, Fragment, ViewGroup).

[android-developers] Are Layouts Reusable?

2012-10-30 Thread Mark Phillips
As a newbie, I was wondering if layouts are reusable. For example, say I have Activities A and B, and they both have the same layout for the screen. So I create Layout L in the file my_layout.xml, which has a Textfield with @id+/textfield1 in the layout and it is blank. In the onCreate() of both

Re: [android-developers] Are Layouts Reusable?

2012-10-30 Thread Romain Guy
You can reuse XML layouts (just like you can reuse any resource.) When you use a layout resource (with setContentView() for instance) it gets inflated. This means the layout is parsed and converted into actual View objects. If you reuse the same layout in several activities, you will simply create

Re: [android-developers] Are Layouts Reusable?

2012-10-30 Thread Mark Phillips
Thanks for your response. What happens to the ids of the elements in the layout? Will I have one id for the TextViews in my example, so when I do something to it (change the color or text, for example), will all the TextViews in all the layouts change? I guess it will not matter on a small screen