title: How to remove a Button added programatically
body: <p>I am adding buttons to a linear layout at runtime and need to add the functionality of removing them if the user desires. At the moment I have a button which opens a popup with a list consisting of the text for each button added. If possible, would I be able to have each onItemClick delete the corresponding button? If not, what would be the best way to remove a specific button?</p>
  
  <p>Here is the code for adding buttons:</p>
  
  <pre><code>private void addButton(){
      LinearLayout lL = (LinearLayout) findViewById(R.id.requirement_linear);
      lL.setOrientation(LinearLayout.VERTICAL);
      LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,LinearLayout.LayoutParams.WRAP_CONTENT);
      p.setMargins(0,2,0,0);
      Button b = new Button(this);
      b.setBackgroundResource(R.drawable.blue_button); 
      b.setOnClickListener(openRequirement);
      b.setTextColor(Color.parseColor("#FFFFFF"));
      String button_text = (index + 2) + ". " + requirement_list.get(index + 1).getName();
      b.setText(button_text);
      requirements_text.add(button_text);// requirements_text is an arraylist&lt;string&gt; which stores the text so I can display them in my popup to delete them.
      index ++;
      lL.addView(b,p);
  }
  </code></pre>