呼叫super.onSaveInstanceState(包)第一个或最后? [英] Call super.onSaveInstanceState(bundle) first or last?

查看:199
本文介绍了呼叫super.onSaveInstanceState(包)第一个或最后?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是更正确的?这:

@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);
}

他们我的姜饼设备和升级Froyo和冰淇淋三明治模拟器,和我在两个工作我已经看到了一样多的例子说,一个办法是其他。有没有关系呢?

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?

推荐答案

只要你的键不冲突(例如, ID 是相同的东西的Andr​​oid内部使用),这两个是相同的。

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

这篇关于呼叫super.onSaveInstanceState(包)第一个或最后?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆