12-02-2010 05:37 PM
I have a doubt related to the use of resource files in an application. Any help on this issue will be useful. My issue is as follows:
I have a library which exposes a set of functions that different BB applications can use. While working on this over a period of time, I have ended up making a host of changes that has caused several parameters to be added to a particular method inside the library.
To overcome this, I thought of the approach of letting the user pass a resource file as a parameter (or a ResourceBundle object) which the library reads and obtains the parameters
Is there a way this can be done? From what I've read, it's required to have a compiled resource file (.rcb) as part of the jar and cod files.
Will this ever be possible if the resource file is part of the application and it is being referenced by the library?
12-03-2010 04:01 AM
welcome to the support forums.
by design a library cannot reference the application, it would not be a library if it could.
of course you can give a library constructor or method call any parameters you want, be it a string pointing to a file or a byte array representing a file you read or...
12-03-2010 07:57 AM
Thanks for the reply!
I do realize that I can get away with passing a parameter of any type to the method in my application. However, the resource files seems to be something different (I think!). To reference this file I guess I need it inside my workspace/jar/cod file.
As you are saying that I can use any type of parameter I want, could you please tell me how I can access the contents of the resource file through the "<ResourceFileName>Resource.java" interface, especially since that interface is now part of the application workspace?
Thanks again for your help!
12-03-2010 08:04 AM
you cannot use (blackberry language) resource files as parameters as they are built internally on compile time, not on runtime.
12-03-2010 09:03 AM
So what you're saying is that I cannot pass a ResourceBundle/ResourceBundleFamily object from my application to one of my library methods? That's too bad. Is there a workaround to this situation?
I guess another way would be to whip up an xml file with the list of parameters and use them accordingly.