Android setContentView within an if statement
<p>this is a follow on from a previous question </p>

<p><a href="http://stackoverflow.com/questions/10287998/android-setcontentview-not-being-applied">Android setContentView not being applied</a></p>

<p>in this if statement i want to be able to setContentView when i set them both to R.layout.introact the if statement works but in the else part i want it to load a different layout but when i change it to R.layout.introact2 it Force closes the app</p>

<p>heres the code</p>

<pre><code>@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");
        }
</code></pre>
