I have an XML layout having a single TextView
Now I want to add 50 buttons which I want to add dynamically in my java file !.
Is it possible to add attributes to an XML file via java code ?? Or can an activity have 2 layouts at a time ??
for eg,
public class Options extends Activity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.options);
Button but=new Button(this);
but.setText("Wassup");
// How do I add this button to the layout ?
}
}