inflate vs findViewById

Posted by Cedric on Stack Overflow See other posts from Stack Overflow or by Cedric
Published on 2010-03-30T04:40:52Z Indexed on 2010/03/30 4:43 UTC
Read the original article Hit count: 202

Filed under:

Hi all,

Suppose I have a simple layout xml like the following:

button.xml:

Are there any differences in the following calls? and which one should i use?

button = (Button) getLayoutInflater().inflate(R.layout.button, null);

and

View v = getLayoutInflater().inflate(R.layout.button, null); button = (Button) v.findViewById(R.id.button01);

© Stack Overflow or respective owner

Related posts about android