title: How to create button at run time on specified location inside frame layout android?
body: <p>I am trying to create button at runtime.I am getting the coordinate and height,width of button from backend and I have to create button at same location on run time.I have used following code.</p>
  
  <pre><code>Button btn=new Button(getApplicationContext());
  btn.setText("CLICK ME");
  @SuppressWarnings("deprecation")
  AbsoluteLayout.LayoutParams param = new AbsoluteLayout.LayoutParams( 121,  58,  50,  50);
  btn.setLayoutParams(param);
  mParentView.addView(btn);
  </code></pre>
  
  <p>My xml is
  
  </p>
  
  <pre><code>&lt;FrameLayout
      android:id="@+id/frameView"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent" &gt;
  
      &lt;ViewFlipper
          android:id="@+id/viewFlipper"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent" &gt;
      &lt;/ViewFlipper&gt;
  
      &lt;fragment
          android:id="@+id/header_fragment"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          class="com.sdei.presentationapp.activity.PresentationModeTopBar"
          tools:layout="@layout/presentation_top_bar" /&gt;
  &lt;/FrameLayout&gt;
  </code></pre>
  
  <p>
  here the parentview is framelayout.</p>
  
  <p>I am able to create the button but the problem is it is created always at top left corner,no matter what coordinate we pass.Please help.
  Thanks in advance.</p>