Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call super.onSaveInstanceState(bundle) first or last?

Tags:

android

Which is more correct? This:

@Override protected void onSaveInstanceState(Bundle outState) {     super.onSaveInstanceState(outState);     outState.putLong(ID, mId); } 

or this:

@Override protected void onSaveInstanceState(Bundle outState) {     outState.putLong(ID, mId);     super.onSaveInstanceState(outState); } 

They both work for me on my Gingerbread device and the Froyo and Ice Cream Sandwich emulators, and I've seen about as many examples saying one way as the other. Does it matter?

like image 581
Ken Fehling Avatar asked Apr 26 '12 22:04

Ken Fehling


1 Answers

So long as your keys do not collide (e.g., ID being the same as something Android uses internally), the two are identical.

like image 111
CommonsWare Avatar answered Sep 22 '22 07:09

CommonsWare