How is an Android activity instantiated (using reflection)?

前端 未结 4 521
时光说笑
时光说笑 2020-12-24 03:41

Got asked this today in an Android interview. I answered the usual, you know, intent + startActivity, etc. Interviewer then asked more pointedly,

\"Ye

4条回答
  •  再見小時候
    2020-12-24 04:24

    Android core is responsible to manage de activity instantiation, and manage it into his activity lifecycle.

    The android system takes care about calling all the events you can control in your class in the correct order, add the activity to the stack and many other things.

    When you call startActivity, Android core takes control and makes an activity instance (or reuse a previous one if match) and starts to call activity lifecycle events

    You can see it here: http://developer.android.com/reference/android/app/Activity.html in Activity Lifecycle part

提交回复
热议问题