• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Why can't we duplicate a View that has been Inflated?

ColonD

Lurker
Ok, I've had this doubt for a while, and I've googled and Stack Overflowed this, but all I'm getting is "you can't" and not a reason. I'm new to Android and Java, so please tell me if any of this is wrong:

As long as a view is inflated without specifying a root, It's just an object with some properties. If I can create a copy constructor of this "View" object, changing any unique ids or something it should have, I should theoretically be able to duplicate the view faster than inflating.

Now I know most people will say Inflating isn't that time consuming, but there could be a case where I might want to create a lot of multiples of the same complex layout on a screen. I only have a rough understanding of the internals of Android as of now, and I'm currently exploring the framework files.
 
Back
Top Bottom