Programmatically add views in android
<p>I have to add two relative layouts next to each other horizontally in android.I know i have to use addRule concept.But i havent got a proper link to achieve this.Can someone provide me some good tutorials on addRule in  android and also solution for this problem.Thanx![As can be seen the two relative layouts should come within one parentlayout.
Following is my code:</p>

<pre><code>       //Layout on which my parentrelativelayout should be added 
        LinearaLayout ll=(LinearLayout)findViewbyId(R.id.ll);

        RelativeLayout parentrelativelayout=new RelativeLayout(mContext);
        parentrelativelayout.setId(1);
        parentrelativelayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.WRAP_CONTENT));
        parentrelativelayout.setBackgroundColor(Color.BLACK);

        RelativeLayout rl_relativelayout1 = new RelativeLayout(mContext);
        rl_relativelayout1.setId(2);
        rl_relativelayout1.setLayoutParams(new LayoutParams(800,LayoutParams.WRAP_CONTENT));
        rl_relativelayout1.setBackgroundResource(R.drawable.voucher_row);

        RelativeLayout rl_relativelayout2=new RelativeLayout(mContext);
        rl_relativelayout2.setId(3);
        rl_relativelayout2.setBackgroundResource(R.drawable.grab_voucher);
        RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,RelativeLayout.LayoutParams.WRAP_CONTENT);
</code></pre>

<p>I need to achieve this PROGRAMMATICALLY in android. ]<a href="http://i.stack.imgur.com/3DZzi.png" rel="nofollow">1</a></p>
