how to set position of fragment in center in RelativeLayout
<p>hi guys I was playing aroung with fragments in android.<br>
I read that there are two ways to bind a fragment in an activity.<br>
1)using <code>&lt;fragment&gt;</code> tag in layout(XML) file.<br>
2)using FragmentManager and FragmentTransaction .<br>
I want my Activity to handle fragment dynamically so i went for the 2nd approach.<br>
But when a fragment is added it is added to left-top corner in RelativeLayout Activity(which appears to be the default behaviour of RelativeLayout)
I want my fragment to appear at center of the Activity Layout.
I just can't figure it out how to give position to fragmet in JAVA code.
I looked into stackoverflow also,</p>

<blockquote>
  <blockquote>
    <p>which uses --RelativeLayout.LayoutParams      </p>
  </blockquote>
</blockquote>

<p>which appears to work with View objects(Button,TextView etc).<br>
Any suggestions.</p>