views:

79

answers:

1

hi all,

i'm reading the android developer docs on creating custom components and one thing that's unclear, is whether you can define the layout of your component using xml and then reuse that across class libraries. like, say for instance, i want to create a class library called myComponents, and in there i want to have myTehAwesumsWidget or whatever, and i want the layout to be defined in xml, can i include that xml in the referenced class library?

A: 

If you replace "class library" with "Android library project", everything you describe should work just fine. Here is an Android library project that distributes a custom widget (also wrapped in a dialog and custom preference).

CommonsWare
Awesome! so the folder structure is the exact same then, and when you reference it, Android finds everything then? that's great.
bryan costanich
@bryan costanich: Resources get merged in, so it is important to choose appropriate naming conventions to avoid collisions, if you are planning on distributing the library widely. I have some notes on that here: http://andparcel.com
CommonsWare