安卓:动态asscociating数据类型与活动数据类型、动态、asscociating

2023-09-04 10:40:48 作者:没有樱桃的丸子

我有一个用例在我的应用程序,其中,后某一点,我需要的数据与活动相关联。所以每当意图与动作和数据类型被解雇了,我的行为可以被打开。我知道,它可以将一个数据类型与通过的Andr​​oidManifest.xml活性静态关联。

是否有可能和动态编程寄存器中的数据类型的活动? 任何指针是AP preciated。

解决方案   

是否有可能和动态编程注册活动的数据类型?

没有。

如果在<你要事先知道,但你只想要一个特定点后启用该功能,您可以实现这一点;意向滤光器&gt通过<以活动为别名> (有它在一开始就被禁用,并通过 PackageManager 启用它编程)。唉,<意向滤光器> 没有出现的东西,你可以启用或禁用,至少根据我的清单文件中看到

前端JavaScript基础

I have a use case in my application, where after certain point, I need to associate an data with an activity. So whenever an intent with an action and the data type is fired, my activity can be opened. I know that it is possible to associate a data type with an activity statically via AndroidManifest.xml.

Is it possible to register the data type for an activity dynamically and programatically ? Any pointers are appreciated.

解决方案

Is it possible to register the data type for an activity dynamically and programatically ?

No.

If the <intent-filter> you want is known in advance, but you only want to enable it after a certain point, you may be able to achieve this via <activity-alias> (have it disabled at the outset and enable it programmatically via PackageManager). Alas, <intent-filter> does not appear to be something you can enable or disable, at least based on what I see in the manifest documentation.