I am working to create fields at run time, like in a relative layout am adding one text field at right corner and one Check-box at the left corner. For this am getting problem, currently i am using the following code:
ViewGroup hori_layout=new RelativeLayout(getParent());
hori_layout.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
TextView tv1=new TextView(getParent());
tv1.setText(_medContactNames[i]);
tv1.setTextColor(Color.BLACK);
CheckBox cb = new CheckBox(getApplicationContext());
hori_layout.addView(tv1);
hori_layout.addView(cb);
layout.addView(hori_layout);