能否请您解释的onCreate和捆绑? [英] Can you please explain onCreate and Bundles?

查看:112
本文介绍了能否请您解释的onCreate和捆绑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在寻找它,我只是不能似乎包裹自己周围的onCreate和捆绑。据我所知,程序启动,但其如何捆绑解决过去了,他们是如何相关的的onCreate被调用。任何人都可以尝试把这个简单易懂的英语,因为我似乎无法找到它很好的描述。

I have been looking it up and I just cant seem to wrap myself around the onCreate and Bundles. I understand that the onCreate is called when the program starts but its how the Bundles get passed around and how they are pertinent. Can anyone try to put this into plain english because I cant seem to find it well described.

感谢

推荐答案

捆绑的onCreate 方法应抱着你的活动状态就被杀死了。

The Bundle in the onCreate method should hold the state of you activity before it was killed.

简单的例子,当您更改设备的方向您的活动被重建。
试想一下,在用户填写一个长形和他/她意外地改变了方向。当应用程序被重新启动进入将丢失所有数据,除非你坚持下去的信息。一种可能性是使用捆绑。

Simple example, when you change the orientation of your device your activity is recreated. Imagine the user is filling a long form and he/she accidentally changes the orientation. When the app gets restarted all data entered will be lost unless you persist that information. One possibility is using a Bundle.

如果你想知道如何使用它,我建议你读<一个href=\"http://stackoverflow.com/questions/151777/how-do-i-save-an-android-applications-state\">this问题。

If you want to know how to use it, I would recommend that you read this question.

这篇关于能否请您解释的onCreate和捆绑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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