onActivityResult is not recognized


I keep getting an error that tells me the onActivityResult() is an invalid type. it’s also saying that my commas should be semi-colons, but that is not what the book says to do. so then i read the full code files from Big Nerd Ranch and the code is different in there.

Here is mine (just like the book) and getting 2 errors:

[code] @Override
protected void onActivityResult(int requestCode; int resultCode; Intent data) {
if (data == null) {
mIsCheater = data.getBooleanExtra(CheatActivity.EXTRA_ANSWER_SHOWN, false);


Here is the full QuizActivity.java code as provided in the Big Ranch Nerd downloads:

@Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { mIsCheater = data.getBooleanExtra(CheatActivity.EXTRA_ANSWER_SHOWN, false); }

Here the if statement is not even there. What do I do to correct this? I can’t run the app without correcting the errors. :cry: Thanks…


Ah, okay, I figured it out. I wrote the block of code within the onCreate() method, which was a mistake. I just wish it was more clear where to put code in this book, it just puts those “…” things in weird places, easy to mess up where exactly it should go.