这是上一个问题的后续内容
Android setContentView not being applied
在这个if语句中我希望能够setContentView当我将它们都设置为R.layout.introact if语句有效但在else部分我希望它加载不同的布局但是当我将它更改为R. layout.introact2它强制关闭应用程序
继承人的代码
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
String leagueCount = getIntent().getStringExtra("leagueCount");
Log.d("lc", "Received league count of:"+ leagueCount);
if ("2".equals(leagueCount)){
setContentView(R.layout.introact);
Log.d("lc", "Using league count of 2 layout");
}else{
setContentView(R.layout.introact);
Log.d("lc", "Using default layout");
}