how to use variable in onSaveInstanceState
This question already has an answer here:
Cyren... 1) I see no reason to call super.onRestoreInstanceState in onCreate. It WOULD make sense to make that call in the method
public void onRestoreInstanceState(Bundle saved) {
super.onRestoreInstanceState(saved);
2) The declaration:
int resultCode = savedInstanceState.getInt("resultCode");
is "hiding" the variable:
int resultCode;
declared earlier. So there are two version of the variable resultCode with different scopes. Perhaps you mean to code:
int resultCode;
stuff here
resultCode = savedInstanceState.getInt("resultCode");
Hope that helps, JAL
链接地址: http://www.djcxy.com/p/26182.html