title: java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first
body: <p>Am struck with the error:</p>
  
  <pre><code>java.lang.IllegalStateException: The specified child already has a parent. You must 
  call removeView() on the child's parent first.
  </code></pre>
  
  <p>I want to create relative layout when click on the send button.</p>
  
  <pre><code>RelativeLayout rl = (RelativeLayout) findViewById(R.id.parentLayout);                                        
  RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
  //layoutParams.setMargins(0, 0, 25, 0);
  RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(
      RelativeLayout.LayoutParams.WRAP_CONTENT,
      RelativeLayout.LayoutParams.WRAP_CONTENT);
  lp.addRule(RelativeLayout.CENTER_IN_PARENT);
  TextView tv= new TextView(ChatWithFriend.this);
  tv.setId(layId);
  tv.setText("data");
  tv.setLayoutParams(lp);
  rl.addView(tv);
  setContentView(rl, layoutParams);
  </code></pre>
  
  <p>Any thing  wrong on my code ?</p>