how to use variable in onSaveInstanceState
<p>I just started learning programming at the android and I have a problem with using variable at onSaveInstanceState. This is my code:</p>

<pre><code>int resultCode;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    if (savedInstanceState != null) {

        super.onRestoreInstanceState(savedInstanceState);

        int resultCode = savedInstanceState.getInt("resultCode");

    } 


    Button btnOpenWithResult = (Button)findViewById(R.id.btnOpenWithResult);
    btnOpenWithResult.setOnClickListener(new OnClickListener() {

        @Override
        public void onClick(View arg0) {
            // TODO Auto-generated method stub
            Intent myIntent = new Intent(flashlight.this, ThirdActivity.class);
            startActivityForResult(myIntent, 1);

        }
    });
}


@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    // TODO Auto-generated method stub
    super.onActivityResult(requestCode, resultCode, data);

    switch (resultCode) {
    case 1:   
         /** option 1  */            
        break;

    case 2:
         /** option 2 */
        break;

} 
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
     savedInstanceState.putInt("resultCode", resultCode);
    super.onSaveInstanceState(savedInstanceState);
}
</code></pre>

<p>I want to save the variable resultCode using onSaveInstanceState and after the resumption of activity once again to use it ...</p>

<p>(sorry for my level of English)</p>
