开发者

Reuse Class File and Resources for Multiple Projects

Background:

I am currently developing an Android application that makes use of a custom dialog to prompt for a password. Thinking ahead, I would like to be able to use this dialog (in its entirety) in my future projects with a minimum of configuration.

Question:

Is there any way I can encapsulate all of the code and XML for this dialog into one package? Ideally, I would like to simply import the dialog and be done with it. T开发者_运维知识库his is easy enough to do with the code, but I am not sure how to do this with the XML layout and string resources files. Basically, I just don't want to have to manually add the string elements to my strings.xml file for each project as well as not have to copy (and thus duplicate) my layout. I gave thought to hard-coding strings / layout into the code, but that seems like bad practice (even for only 4-5 strings and 2 textboxes).

So, what would be the best way to do this?


You need to create a library project, that allows to share both code and resources.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜