开发者

Android - Using an Activity without a manifest entry

开发者 https://www.devze.com 2023-04-10 11:50 出处:网络
I have been working on a bunch of utility activities. The goal is that the user simply can reuse the source code and there is no need for any layout xml files. Hence, all the layouts are created progr

I have been working on a bunch of utility activities. The goal is that the user simply can reuse the source code and there is no need for any layout xml files. Hence, all the layouts are created programmatically. There is no reference to any layout xml file.

The only problem I am running into is that the user is forced to enter the开发者_如何学C activities in the manifest file.

I am wondering if there is a way to bypass this step by the user. Perhaps the user can call some Init() method in my code that will programmatically add activities to the "manifest" object. There must be some notion of manifest object as Android is looking it up when a new activity is created.

Thank you in advance for your help.


The goal is that the user simply can reuse the source code and there is no need for any layout xml files. Hence, all the layouts are created programmatically. There is no reference to any layout xml file.

This hardly seems like a good thing. Now you are preventing your reusers from readily modifying matters, to tweak for different device characteristics that you are not yet supporting, etc. Android library projects allow you to create reusable components that contain layout files and other resources.

I am wondering if there is a way to bypass this step by the user.

No, sorry, that is impossible.

Eventually, I think Android library projects will support merging of manifests to help deal with this.

0

精彩评论

暂无评论...
验证码 换一张
取 消