简体   繁体   中英

“Intent” from Activity to Application

I know there is no option to Intent from Activity to Application. There is other way to trigger and move to extends Application class from extends Activity class?

I build a project on Android Studio that extends Application and then added extends Activity for the opening of the application. now, I can't find a way to move from the Activity class to the Application class.

There is a possible way?

You may be misunderstanding the difference between an Application and an Activity .

There exists only one Application per Android App. There can be many Activity classes in your App.

You cannot fire an Intent to an Application . The Application is not a part of your interface, it is a class that can help you maintain a global state over your entire App. Application documentation .

An Activity however is the main encompassing object that contains your user interface. Activity documentation .

From http://www.tutorialspoint.com/android/android_intents_filters.htm :

An Android Intent is an abstract description of an operation to be performed. It can be used with startActivity to launch an Activity, broadcastIntent to send it to any interested BroadcastReceiver components, and startService(Intent) or bindService(Intent, ServiceConnection, int) to communicate with a background Service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM