[英]“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. 我在Android Studio上构建了一个可扩展Application的项目,然后为应用程序的打开添加了extension Activity。 now, I can't find a way to move from the Activity class to the Application class.
现在,我找不到从Activity类转到Application类的方法。
There is a possible way? 有可能的办法吗?
You may be misunderstanding the difference between an Application
and an Activity
. 您可能会误解
Application
和Activity
之间的区别。
There exists only one Application
per Android App. 每个Android应用程序只有一个
Application
程序。 There can be many Activity
classes in your App. 您的应用程序中可以有很多
Activity
类。
You cannot fire an Intent
to an Application
. 您不能向
Application
激发Intent
。 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
不是您界面的一部分,它是一个类,可以帮助您维护整个应用程序的全局状态。 Application documentation . 应用文件 。
An Activity
however is the main encompassing object that contains your user interface. 但是,
Activity
是包含用户界面的主要包含对象。 Activity documentation . 活动文件 。
From http://www.tutorialspoint.com/android/android_intents_filters.htm : 从http://www.tutorialspoint.com/android/android_intents_filters.htm :
An Android Intent is an abstract description of an operation to be performed.
Android Intent是要执行的操作的抽象描述。 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.
它可以与startActivity一起使用,以启动活动,将其发送到任何感兴趣的BroadcastReceiver组件的broadcastIntent,以及与后台服务通信的startService(Intent)或bindService(Intent,ServiceConnection,int)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.