Lai Yu-Hsuan Lai Yu-Hsuan - 6 months ago 32
Android Question

What's packageContext in Intent#(Context packageContext, Class<?> cls)?

The document says :

packageContext A Context of the
application package implementing this

But what does it mean? which class is "this class"?

new Intent(this,XXX.class)

Flo Flo

You can pass any Context object you got from any of you application's classes. So you can either use an Activity, Service object or you can call getApplicationContext() and pass the returned Context object to the Intent constructor.