Adding a group of elements and making them appear dynamically when pressing a button in Android
<p>I want to add a group of elements (textbox, button, progress bar and text view) and have them appear dynamically when pressing a button in Android. At every button press I want to create a group of the elements and put them in an relative layout. Here is my <code>oncreate</code> method:</p>

<pre><code>protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    // The add button to insert new downloading file
    add = (Button) findViewById(R.id.button_add_url);
    add.setOnClickListener(this);

    // Swapping between pause and resume
    pause = (Button) findViewById(R.id.button_pause_resume);
    pause.setOnClickListener(this);

    download = (Button) findViewById(R.id.button_download);
    download.setOnClickListener(this);

    // The progress is written here
    text = (TextView) findViewById(R.id.textView2);
    text.setTextColor(Color.WHITE);

    progress = (ProgressBar) findViewById(R.id.progressBar1);
}
</code></pre>
