title: Adding multiple framelayout in a linearlayout programmatically
body: <p>I need to overlap an image view with textview. And this combined view will be repeated 100 times in a LinearLayout. I was thinking of using FrameLayout in LinearLayout and Repeating the FrameLayout in LinearLayout 100 times when FrameLayout holds the imageview and textview overlapped. 
  Need to do this programatically not from xml file. </p>
  
  <p>I added the image and textview to framelayout first then tried to add the framelayout to linearlayout. But it says : the specified child has already a parent.. so not working. Can you please show me in code? Thanks for your help.</p>
  
  <p>it is going to be like this, but need to be done programmaticaly</p>
  
  <pre><code>---linear layout--------------
  ------------------------------
  |frame layout----------------|
  ||txt view on top of img view|
  ------------------------------
  frame layout will be repeated|
  
  ---/end of linear layout------
  </code></pre>
  
  <p>Also here is the separated code:</p>
  
  <pre><code>public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_test);
  
          LinearLayout dynamicview = (LinearLayout) findViewById(R.id.main_layout);
  
          FrameLayout barFrameLayout = new FrameLayout(this);
          FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
                  LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT,
                  Gravity.CENTER);
          barFrameLayout.setLayoutParams(params);
  
  
          LinearLayout.LayoutParams slparams1 = new LinearLayout.LayoutParams(
                  LinearLayout.LayoutParams.WRAP_CONTENT,
                  LinearLayout.LayoutParams.WRAP_CONTENT);
  
          for (int i = 65; i &lt;= 75; i++) {
              TextView catTV = new TextView(this);
              catTV.setLayoutParams(slparams1);
              catTV.setText("===" + Character.toString((char) i) + "===");
              catTV.setTextSize(32);
  
              ImageView iv = new ImageView(this);
              iv.setImageResource(R.drawable.ic_launcher);
              iv.setLayoutParams(slparams1);
  
              barFrameLayout.addView(catTV);
              barFrameLayout.addView(iv);
  
              dynamicview.addView(barFrameLayout);
          }
      }
  </code></pre>