[android-developers] Re: Creating a private jar
Yes there is another way.. I must preface this this does not work for all resources.. However, if you are only dealign with layout prameters about 75% fo those XML attributes have the corresponding accessible setters and getters.. That means if you rewrite the widgets to use setters and getters to set the vie up instead of xml you can than load the layout file as xml in a zip package on a sd card for example.. For exampe you could skin the homeScreen app using this method :) On Apr 2, 12:28 pm, Cyril Mottier wrote: > Yeah it's kinda boring to use that method :(. I developped my widgets > in order to create them easily in an XML layout. Using the way you > gave me (which, I think, is not that bad when you're just using > images), the user won't be able to create it through an XML layout. > Moreover, my classes use the attrs.xml file to retrieve XML > parameters. > > As you said Mark, I'm, like you, also looking for another way around > this! > > On Apr 2, 6:02 pm, "Mark Murphy" wrote: > > > > Looking at the Android source code, I noticed that android.jar > > > contains its own ressources so I assume this is possible. > > > Yeah, but that's special. > > > There is no way for JARs written to support SDK-level applications to > > embed resources that I have found. > > > Instead, you need to package your resources separately (e.g., a ZIP file) > > and distribute them for reusers of your JAR to unpack in their APK > > project's res/ tree (or to replace with their own editions of the > > resources, as they see fit). Then, adjust your API to accept resource IDs > > as parameters (like you see for many of the APIs), so your code no longer > > has R.id or R.drawable references itself -- those refererences would be in > > the calling application, who has the resources and the corresponding > > R.java file. > > > If there's another way around this, I'm certainly interested to hear about > > it... > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com > > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Creating a private jar
Yeah it's kinda boring to use that method :(. I developped my widgets in order to create them easily in an XML layout. Using the way you gave me (which, I think, is not that bad when you're just using images), the user won't be able to create it through an XML layout. Moreover, my classes use the attrs.xml file to retrieve XML parameters. As you said Mark, I'm, like you, also looking for another way around this! On Apr 2, 6:02 pm, "Mark Murphy" wrote: > > Looking at the Android source code, I noticed that android.jar > > contains its own ressources so I assume this is possible. > > Yeah, but that's special. > > There is no way for JARs written to support SDK-level applications to > embed resources that I have found. > > Instead, you need to package your resources separately (e.g., a ZIP file) > and distribute them for reusers of your JAR to unpack in their APK > project's res/ tree (or to replace with their own editions of the > resources, as they see fit). Then, adjust your API to accept resource IDs > as parameters (like you see for many of the APIs), so your code no longer > has R.id or R.drawable references itself -- those refererences would be in > the calling application, who has the resources and the corresponding > R.java file. > > If there's another way around this, I'm certainly interested to hear about > it... > > -- > Mark Murphy (a Commons Guy)http://commonsware.com > _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: Creating a private jar
> Looking at the Android source code, I noticed that android.jar > contains its own ressources so I assume this is possible. Yeah, but that's special. There is no way for JARs written to support SDK-level applications to embed resources that I have found. Instead, you need to package your resources separately (e.g., a ZIP file) and distribute them for reusers of your JAR to unpack in their APK project's res/ tree (or to replace with their own editions of the resources, as they see fit). Then, adjust your API to accept resource IDs as parameters (like you see for many of the APIs), so your code no longer has R.id or R.drawable references itself -- those refererences would be in the calling application, who has the resources and the corresponding R.java file. If there's another way around this, I'm certainly interested to hear about it... -- Mark Murphy (a Commons Guy) http://commonsware.com _The Busy Coder's Guide to Android Development_ Version 2.0 Available! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---