1.onCreate()
1.onCreate(Bundle) is where you initialize your activity.
Most importantly, here you will usually call setContentView(int) with a layout resource defining your UI,
and using findViewById(int) to retrieve the widgets in that UI that you need to interact with programmatically.
2.Called when the activity is starting.
This is where most initialization should go:
calling setContentView(int) to inflate the activity‘s UI,
using findViewById(int) to programmatically interact with widgets in the UI,
calling managedQuery(android.net.Uri, String[], String, String[], String) to retrieve cursors for data being displayed, etc.
3.You can call finish() from within this function, in which case onDestroy() will be immediately called 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.
onCreate()在一个activity启动时应被最先调用,
进行初始化,
这个函数调用完后,
这个activity并不是说就已经启动了,或者是跳到前台了。
而是还需要其他的大量工作,
我们知道:onCreate之后还有
onStart() 和 onRestart()
实际上onStart()调用完毕了这个activity还没有完全启动,也只是前台可见,
直到 onResume() 调用后这个onCreate才算终于启动。
2.onCreate中的savedInstanceState有何具体作用
在activity的生命周期中,只要离开了可见阶段,或者说失去了焦点,activity就很可能被进程终止了!被KILL掉了,这时候,就需要有种机制,能保存当时的状态,这就是savedInstanceState的作用。