The Intent constructors parameters

前端 未结 3 1840
醉话见心
醉话见心 2021-02-19 06:52

The Intent class had 6 constructors

Intent()

Create an empty intent.


Inten

3条回答
  •  有刺的猬
    2021-02-19 07:36

    Take a look at the argument Context very closely in the fifth Intent declaration. It reflects polymorphism. The Intent takes a Context argument so you can pass any object that is a Context or derives from the Context class.

    Activity, AppCompatActivity, IntentService, Service all derive from the Context class and hence can be passed as an argument to the method.

提交回复
热议问题