tags:

views:

2659

answers:

2

I've notice in some coding people use icicle with the onCreate method and I was wondering what it is exactly:

public class About extends Activity {
 @Override
 protected void onCreate(Bundle icicle) {
      super.onCreate(icicle);
      setContentView(R.layout.whatup);
}

Is this the same thing as savedInstanceState?

+5  A: 

The name isn't magic. It's just a placeholder for one of the formal parameters. As shown by the API, onCreate takes one Bundle parameter. It's up to you what to call it.

Matthew Flaschen
Thank you for clarifying that to me. Excuse my ignorance, but what is it that I'm manipulating once I pass it through to the class? I'm trying to wrap my head around this. I guess with savedInstanceState it's suppose to pull in the last saved data when the user restores the activity again.Thank you for helping understand this. I appreciate it big time!
wavyGravy
What do you mean "once I pass it through"? When Android calls onSaveInstanceState, that gives you the chance to save your state in a Bundle (http://developer.android.com/reference/android/os/Bundle.html). Later, when your app is restarted, you will be passed a Bundle to restore data from.
Matthew Flaschen
+7  A: 

"icicle" is sometimes used as the name of the parameter because onSaveInstanceState() used to be called onFreeze().

Brad Ackerman
Ah..I get it now. I got that analogy. Thank you!
wavyGravy