Setting different layouts to the same activity is bad design. Every Activity has a life cycle and should have just one layout set to the activity.
Instead start a new Activity and set board_play
to the same.
Use
@Override
public void onClick(View view) {
startActivity(new Intent(MainActivity.this,BoardActivity.class));
}
In BoardActivity
public class BoardActivity extends Activity
{
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.board_play);
}
Make sure you make an entry for BoarActivity in manifest file.
You can also use fragments.