Use of Context to start another Activity

前端 未结 3 947
無奈伤痛
無奈伤痛 2020-11-30 11:36

To start an Activity you need an Intent, like:

Intent i = new Intent(context, class)

So to fill in the context parameter, a couple of optio

3条回答
  •  孤街浪徒
    2020-11-30 11:48

    They are different for sure. These are different contexts, and should be used with the least possible scope(context).

    For example if we can use Activity's Context instead of ApplicationContext, one should use the activity context, same applies to application context, and base context.

提交回复
热议问题