Lai Yu-Hsuan Lai Yu-Hsuan - 1 year ago 360
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
Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download