Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is inflater?

 
fahimeh hashemian
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I read Hello Android book and i dont understand MenuInflater and inflater.
I searched and i read android site but android site had written a brief explanation and i dont understand that what is this and what does it do?

@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
MenuInflater inflater = getMenuInflater();
inflater.inflate(R.menu.menu, menu);
return true;
}

can anybody explain it with straightforward way with example?
Cheers.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inflating means to read the XML file that describes a layout (or GUI element) and to create the actual objects that correspond to it, and thus make the object visible within an Android app.
 
fahimeh hashemian
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for answer
I want to create the optionsMenu and with select one of items in menu and the page on app changes, do the book use inflator for to read xml file that is for new page after selected item and to create the new page?
Do i understand correctly?
Thanks for help.
Cheers.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, I don't understand what you're asking. Can you rephrase it? Also, what book are you referring to?
 
fahimeh hashemian
Ranch Hand
Posts: 85
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to create a menu of items and when i selected a items of menu,the page changed and new page will open.
I question is that, Is that a new page opens the inflater to creaets?

Please more explanation of inflater and
MenuInflater.

I read Hello Android book.
I think this book not explained well. Do you know a good book? Can you introduce me?

Please help me
Cheers

 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Inflation will be used if the layout of the new activity is described via an XML file.

I only read one Android book; here's my review: http://www.javaranch.com/bunkhouse/bookSearch.jsp?title=unlocking+android. Note that there's a 2nd edition out now.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic