I am creating a library, which should be distributed as a jar file.
Public function is void SomeLibClass.showSomeDialog(Context context) and task library is dialog show with a complex View inside. No activity, nothing difficult.
The pattern using library – developer add it to your project, and call in one place SomeLibClass.showSomeDialog and enjoy the funny dialog.
Seems logical that the resources needed to render the dialog were inside the jar file(to avoid errors such as: jar updated, but no resources) – we need in jar file: layout, string, drawable, etc.
And i want call resource by Id, like when i make layout i continue write like android:text=”@string/hello”
But this logical thing to do can not be obtained.. now i make all resources in jar file with prefix, but how to solve the problem with the same id in R.java?
Or am I wrong look, and this is all we have to somehow do differently? Wants to repeat a simple – all you need for the library was in it.
If you wish to distribute Android-compatible Java code with resources, you need to use an Android library project.
The upcoming r14 edition of the Android Developer Tools reportedly has the ability to package up a library project, including resources, as a JAR. r14 should be released soon — I would wait until this is released and then see how to apply it to your project.