2020 0207 2 onCreate

3 篇文章 0 订阅
3 篇文章 0 订阅

2020 0207 2

onCreate

原文

android.support.v7.app.AppCompatActivity protected void onCreate(@Nullable android.os.Bundle savedInstanceState)

Description copied from class: android.app.Activity

Called when the activity is starting. This is where most initialization should go: calling setContentView(int) to inflate the activity’s UI, using findViewById to programmatically interact with widgets in the UI, calling managedQuery(Uri, String[], String, String[], String) to retrieve cursors for data being displayed, etc.
You can call finish from within this function, in which case onDestroy() will be immediately called after onCreate without any of the rest of the activity lifecycle (onStart, onResume, onPause, etc) executing.
Derived classes must call through to the super class’s implementation of this method. If they do not, an exception will be thrown.
Overrides: onCreate in class FragmentActivity
Params: savedInstanceState – If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in onSaveInstanceState. Note: Otherwise it is null.

总译

描述复制自类android.app.Activity。

当活动启动时调用此方法。

大多数的初始化工作均在此处进行:调用setContentView(int)方法来填充活动的UI,调用findViewById方法以编程的方式与在此UI中的小部件进行交互,调用 managedQuery(Uri, String[], String, String[], String)方法来检索正在显示的数据的游标等等。

你可以在此函数内调用finish方法,这样的话onDestory()方法便会在onCreate方法执行后立即被调用,而不会执行活动生命周期其它的部分(onStart, onResume, onPause等等)

派生类必须调用这个方法的超类的实现。否则抛出异常。

重写:在类 FragmentActivity中的onCreate。

参数:savedInstanceState——如果活动在之前被关闭后重新进行初始化,那么此Bundle便包含它最近在onSaveInstanceState中提供的数据。注意:否则它是null.

句译

Description copied from class: android.app.Activity

描述复制自类android.app.Activity

Called when the activity is starting.

当活动启动时调用此方法

This is where most initialization should go: calling setContentView(int) to inflate the activity’s UI, using findViewById to programmatically interact with widgets in the UI, calling managedQuery(Uri, String[], String, String[], String) to retrieve cursors for data being displayed, etc.

大多数的初始化工作均在此处进行:调用setContentView(int)方法来填充活动的UI,调用findViewById方法以编程的方式与在此UI中的小部件进行交互,调用 managedQuery(Uri, String[], String, String[], String)方法来检索正在显示的数据的游标等等。

You can call finish from within this function, in which case onDestroy() will be immediately called after onCreate without any of the rest of the activity lifecycle (onStart, onResume, onPause, etc) executing.

你可以在此函数内调用finish方法,这样的话onDestory()方法便会在onCreate方法执行后立即被调用,而不会执行活动生命周期其它的部分(onStart, onResume, onPause等等)

Derived classes must call through to the super class’s implementation of this method. If they do not, an exception will be thrown.

派生类必须调用这个方法的超类的实现。否则抛出异常。

Overrides: onCreate in class FragmentActivity

重写:在类 FragmentActivity中的onCreate

Params: savedInstanceState – If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in onSaveInstanceState. Note: Otherwise it is null.

参数:savedInstanceState——如果活动在之前被关闭后重新进行初始化,那么此Bundle便包含它最近在onSaveInstanceState中提供的数据。注意:否则它是null.

积累

cursor

n. 光标;(计算尺的)[计] 游标,指针

inflate

vt. 使充气;使通货膨胀
vi. 膨胀;充气

derived

adj. 导出的;衍生的,派生的
derive vt. 源于
derived classes 派生类

bundle

n. 束;捆


参考学习自:
Android Studio 里的源码解释文档(鼠标划至相应代码自动调取英文释义)

另:android有关此部分的官方文档


此文仅交流学习,与诸君共勉进步!
如有不当之处,望告知以便改进。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值