Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

The document says :

packageContext A Context of the application package implementing this class.

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

Why new Intent(this,XXX.class) works?

like image 733
Lai Yu-Hsuan Avatar asked Apr 09 '11 09:04

Lai Yu-Hsuan


People also ask

What is package context android?

Informally, a context is the background information that you might want to know about the things that are actually happening.\nFor an Android app, the Context Java object might include the app's package name, the theme, the wallpaper, the names of files associated with the app, and pointers to location services, to ...

What is intent Flag_activity_new_task?

The flags you can use to modify the default behavior are: FLAG_ACTIVITY_NEW_TASK. Start the activity in a new task. If a task is already running for the activity you are now starting, that task is brought to the foreground with its last state restored and the activity receives the new intent in onNewIntent() .

What are intents in java?

An intent is to perform an action on the screen. It is mostly used to start activity, send broadcast receiver,start services and send message between two activities. There are two intents available in android as Implicit Intents and Explicit Intents.

What is Android intent Action view?

An intent allows you to start an activity in another app by describing a simple action you'd like to perform (such as "view a map" or "take a picture") in an Intent object.


1 Answers

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.

like image 135
Flo Avatar answered Sep 27 '22 23:09

Flo