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

Apps What does inflate do?

I am obviously new to android programming and I am understanding everything rather well, except inflating views and layouts. What is the purpose of this?
If someone could clarify it would be a HUGE help to me.
 
if you want to add views programatically you can inflate the xml layout files.
inflating a view means converting a view from xml into a view object.
 
#4+.. which then enables you to have some kind of templates created in layout XML's which you can, programatically, add anywhere you want them, from generic data.

Say you have an app where users can add different notes to something and you want a button to add a new field for input. Then you could have a userinput.xml that specifies just that part of the layout, taking care of positions, pictures, headers, whatever. And then you just inflate them and add them to a parent view, e.g. a LinearLayout...
 
Back
Top Bottom