Removing Layout on a button clilck
<p>I am working on android.And i was creating an application in which  i dynamically created a group of buttons on a button click.But what happens is buttons are created every time i click the button.i want this to happen once.Can i clear the space just at the beginning of <code>OnClickListener()?</code> i dunno how to do it.Below is my code.</p>

<pre><code>button_generate.setOnClickListener(new View.OnClickListener() {
                    public void onClick(View v) {
                               //*-----------clearing the variables--------*
                        final TableLayout rel=(TableLayout)findViewById(R.id.tab1);



                        int k=0,i=0,j=0;

                                  count=3;
                                    System.out.println("count is"+count);

                                    while(j&lt;count)      
                                    {



                                              TableRow tr = new TableRow(EspeakerActivity.this);
                                              //for(int c=1; c&lt;=3; c++) {
                                                  Button b1 = new Button (EspeakerActivity.this);
                                                  Button b2= new Button (EspeakerActivity.this);
                                                  Button b3 = new Button (EspeakerActivity.this);
                                                  b1.setText("1");
                                                  b2.setText("2");
                                                  b3.setText("3");

                                                  b1.setTextSize(10.0f);
                                                 200));

                                                  tr.addView(b1, 100,50);
                                                  tr.addView(b2, 100,50);
                                                  tr.addView(b3, 100,50);

                                              rel.addView(tr);




                                        }


                            j++;
                                    }



                    }
                    }
                    );//*--------closing the button click------*
</code></pre>
