title: Android generate new objects from onClick
body: <p>I try to develop a simple Android App with one <code>Button</code> which generates new <code>TextViews</code> on each click. </p>
  
  <pre><code> import android.app.Activity;
   import android.os.Bundle;
   import android.text.Layout;
   import android.view.View;
   import android.widget.Button;
   import android.widget.TextView;
  
   public class CreateTV extends Activity {
  
      public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
  
         setContentView(R.layout.main);
         Button mCreate = (Button)findViewById(R.id.btnCreate);
  
         mCreate.setOnClickListener(new View.OnClickListener() {
  
         @Override
         public void onClick(View v) {
              // TODO Auto-generated method stub
              ((Button) v).setText("Clicked");
              TextView mTV1 = new TextView(this);
         }
     });
   }
  }
  </code></pre>
  
  <p>My code is wrong because of:</p>
  
  <pre><code>               TextView mTV1 = new TextView(this);
  </code></pre>
  
  <p>I could find <a href="https://stackoverflow.com/questions/7195056/how-do-i-programmatically-add-buttons-into-layout-one-by-one-in-several-lines">some similar examples</a>, which generate objects programmatically in <code>onCreate()</code>. But I want to generate and modify new objects in <code>onClick()</code>. 
  Would anybody please help?</p>