Android的icicle参数是什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/919153/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 02:30:24  来源:igfitidea点击:

What is Android's icicle parameter?

android

提问by wavyGravy

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

我注意到在一些编码中人们使用 icicle 和 onCreate 方法,我想知道它到底是什么:

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?

这是同一个东西savedInstanceState吗?

回答by Brad Ackerman

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

"icicle" 有时用作参数的名称,因为onSaveInstanceState()以前被称为onFreeze().

回答by Matthew Flaschen

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.

这个名字并不神奇。它只是形式参数之一的占位符。如API所示, onCreate 接受一个 Bundle 参数。这取决于你怎么称呼它。