Reputation: 31
Why is a Context
object reference required while creating an Intent
object??
Intent i = new Intent(context,Target.class);
Upvotes: 1
Views: 81
Reputation: 41357
The Context
contains information about the current runtime state of the app, and is vital to the processing of Intent
s. For example, it keeps track of the application's permissions to ensure that the app is allowed to perform the requested action.
Upvotes: 0
Reputation: 13501
Probably because to keep your data linked.. Intent keeps information and shares it where as Context keeps the whole Application together...
In programmers view.. Context has methods/fields which Intent needs for Object creation..
Upvotes: 1
Reputation: 40416
Context is reffred as object of Activity class so its necessary to start Another Activity from this(Context) Activity
Upvotes: 2