savedInstanceState cannot be resolved to a variable

Posted by Hector on Stack Overflow See other posts from Stack Overflow or by Hector
Published on 2011-01-02T09:50:59Z Indexed on 2011/01/02 9:53 UTC
Read the original article Hit count: 314

Filed under:
|
|

I'm currently working through "The Android Developers Cookbook" and one of the tutorials involves multiple activities in an app. To give a bit of background right now I have to .java files, a "menu screen" and a "game screen". The menu screen simply has a button that leads to the game screen which is currently empty except for a button that takes you back to the menu screen. Currently the game.java file is giving me a "savedInstanceState error" this is the code I am working on.

public void onCreate(Bundle savedInsanceState) {
            // below is where the error comes up
    super.onCreate(savedInstanceState);
    setContentView(R.layout.game);


    Button startButton = (Button) findViewById(R.id.end_game);
    startButton.setOnClickListener(new OnClickListener() {
        public void onClick(View view) {
            finish();
        }
    });
}

I'm not sure why the error is coming up because on the first java file that same "public void...setContentView..." bit of code compiled perfectly fine...

Please help!

© Stack Overflow or respective owner

Related posts about java

Related posts about android