Well, I want to randomly call a layout, the problem is to call it, I thought about saving all the layouts in an array and based on randomly generated numbers call the layout in that position of the array, I thought I would do it this way:
String listalayouts[] = new String[100];
listalayouts[0]="layout1.xml";
botao.setOnClickListener(new View.OnClickListener() {
String x="R.layout."+listalayouts[0];
public void onClick(View v) {
setContentView(x);
}
});
This does not work because x is not of type View and you can not do cast from String to view. Does anyone have a solution?
Thank you in advance for any help.