i was wondering : the “output” parameter is sent to the superclass, but we add “putSerializable” to it just after that : doesn’t it matter that we “modify” it just after we call the superclass? how the app will know that we added this serializable if the project is refreshed? (why don’t we put the serializable first, and then we call the superclass?)
@Override
protected void onSaveInstanceState(Bundle outState) {
super.onSaveInstanceState(outState);
outState.putSerializable(NotesDbAdapter.KEY_ROWID, mRowId);
}
and our onCreate method:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
mRowId = (savedInstanceState == null) ? null : (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
Thanks
You can do either.
The outState is passed to the super by reference therefore any changes afterwards still affect the object.
It’s best explained here:
http://www.yoda.arachsys.com/java/passing.html