-3

I'm making an app and almost everything in it (The textboxes, menus, textviews) are created and shown programmatically.

When I have to show different content, I delete everything in the view and load the new textboxes, menus etc.

Is it better to create a new view each time?

Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142
Enrique Alcazar
  • 381
  • 7
  • 21
  • No, it really is not. But depending on your implementation, you can avoid most pitfalls and make it work just fine. – Shark Feb 12 '16 at 10:02

1 Answers1

2

Not, that much.

Overriding same view

You have to maintain visibility of all components

Is it better to create a new view each time?

If you can maintain all components than not needed otherwise you have to create.

AND

Found here ,Inflating view is very fast (almost as fast as creating views manually).

It might be surprising for you to hear but inflate in fact does not parse the XMLs at all. XMLs for layout are parsed and pre-processed at compile time - they are stored in a binary form which makes view inflation very efficient.

Community
  • 1
  • 1
Amit Vaghela
  • 22,772
  • 22
  • 86
  • 142