how to remove sublayout from the Layout in Android?
<p>I am new to Android.Can anyone give some ideas for my problem.</p>

<pre><code>    /* Parent Linear Layout */

    final LinearLayout par_layout=new LinearLayout(this);
    par_layout.setOrientation(LinearLayout.VERTICAL);

    /* Child Linear Layout */
    final LinearLayout chl_layout=new LinearLayout(this);
    chl_layout.setOrientation(LinearLayout.VERTICAL);

    TextView tv_name=new TextView(this);
    tv_name.setText("Name ");

    TextView tv_item=new TextView(this);
    tv_item.setText("Items ");

    Button btn_submit=new Button(this);
    btn_submit.setText("Submit");
    btn_submit.setOnClickListener(new OnClickListener() {           
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            par_layout.removeAllViewsInLayout();                
        }
    });

    chl_layout.addView(tv_name);
    chl_layout.addView(tv_item);
    chl_layout.addView(btn_submit);        
    par_layout.addView(chl_layout); 
    setContentView(par_layout);
</code></pre>

<p>In the above code at the time of button click i wish to clear the chl_layout from the par_layout.But i can't . Can anyone give some ideas ??</p>

<p>Note :
The following code also not working </p>

<pre><code> par_layout.removeView(chl_layout);
</code></pre>
