I have an actyvity_main, containing 3 radiobuttons (each one corresponds to a layout), and a button. After the user selects the option, he clicks the button, which makes a call to another activity, where in it, I need to do with the selected layout.
public void onClick(View view) {
int checkeRadioButtonId = escolhaRadio.getCheckedRadioButtonId();
switch (checkeRadioButtonId) {
case R.id.rdb1:
Intent opcao8 = new Intent(this, Activity_Jogo.class);
setContentView(R.layout.layout_8);
startActivity(opcao8);
break;
case R.id.rdb2:
Intent opcao10 = new Intent(this, Activity_Jogo.class);
setContentView(R.layout.layout_10);
startActivity(opcao10);
break;
case R.id.rdb3:
Intent opcao12 = new Intent(this, Activity_Jogo.class);
setContentView(R.layout.layout_12);
startActivity(opcao12);
}
}
In this way I'm doing it, it calls the layout and, after appearing it instantly calls the activity, leaving only the activity with its default layout.