Inflating a views tree always creates new instances of views, there's
no singleton. Without seeing your code, I cannot tell you what you are
doing wrong unfortunately.

On Mon, Feb 1, 2010 at 11:04 PM, Ryan Moulton <ryanmoul...@gmail.com> wrote:
> Hi everyone. Just getting started with developing for Android, so
> apologies if there's an obvious answer.
>
> I'm working on an application in which it's necessary to
> programmatically change the entire structure of the UI. What I would
> like to be able to do is specify a subtree of the UI in xml, and then
> instantiate that multiple times as required throughout the tree. For
> instance, if I need the user to set a numerical value, I'd like to use
> xml to define all the widgets involved, increment and decrement
> buttons for instance, and then reference this same file whenever I
> need a UI of that sort.
>
> Unfortunately, When I inflate the xml multiple times, I get the
> following exception.
>
> IllegalStateException
> "The specified child already has a parent. You must call removeView()
> on the child's parent first."
>
> This I'm assuming is because Inflating isn't creating a new object
> each time, but rather creating a static singleton. Is there a good way
> to do what I'm hoping to do, or should I abandon trying to use the xml
> interface?
>
> -Ryan
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>



-- 
Romain Guy
Android framework engineer
romain...@android.com

Note: please don't send private questions to me, as I don't have time
to provide private support.  All such questions should be posted on
public forums, where I and others can see and answer them

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to