It's difficult to troubleshoot this without seeing the stack trace of the error. I'm also suspicious because if the setContentView() method was the problem, you wouldn't have a button to click because the app would have already crashed before you got that far (I'm referring to your post at stackoverflow.com). One thing I see that is not good is how you check which button is clicked. The usual thing that developers do is something like this: