Why to inflate layout into another layout in Android?
<p>I'm new in Android development and I wanted to make application that has header, body and footer and by clicking on one of the buttons in footer some layout will be loaded into body. I used some kind of "MasterPage" as described <a href="http://jnastase.alner.net/archive/2011/01/08/ldquomaster-pagesrdquo-in-android.aspx" rel="nofollow">here</a>.
When the button is pressed neither <code>new_exercise</code> layout nor <code>exercises</code> layout is loaded. Why? Maybe instead of all of this I should use any kind of tabs? Or maybe I can't inflate layout and should create new activity?</p>

<p>Here the code of the BaseActivity and NewExercise activity:</p>

<pre><code>public class BaseActivity extends Activity{
    LinearLayout linBaseBody;

    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.base_layout);

        linBaseBody = (LinearLayout)findViewById(R.id.base_body);

        initButtons();
    }
    @Override
    public void setContentView(int id) {
        LayoutInflater inflater = (LayoutInflater)getBaseContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        inflater.inflate(id, linBaseBody);
    }

    private void initButtons()
    {
        Button btn1 = (Button) findViewById(R.id.newEx);
        btn1.setOnClickListener(new View.OnClickListener() {
              public void onClick(View view) {
                  setContentView(R.layout.new_exercise);
              }
        });
        Button btn2 = (Button) findViewById(R.id.showAllEx);   
        btn2.setOnClickListener(new View.OnClickListener() {
              public void onClick(View view) {
                  setContentView(R.layout.exercises);
              }
        });
    }

public class NewExercise extends BaseActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.setContentView(R.layout.new_exercise);
    }
}
public class Exercises extends BaseActivity {    
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        
        setContentView(R.layout.exercises);
    }       
}
</code></pre>
