Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany
Accepted Solution

Resource files used by multiple applications

I have a library that i use with multiple applications. It is not compiled as an extra project but classes are added to the workspace in a on-need basis.
This library uses its own resource file.

The problem is that this resource file seems not to be updated when i change it. I get a MissingResourceException every few meters.
Are resource files stored independent from the application?
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Resource files used by multiple applications

What do you mean by "every few meters"?

 

Is this exception thrown by the library itself or an application that relies on the library?

 

Resource files should be updated when the project that contains them (your library in this case) is built.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Resource files used by multiple applications

The library is only a virtual library as it is not existing on the blackberry. All classes are used in my projects on a need basis.
That means my file BlackBerryLibRes.rrh/rrc (etc) are added to each JDE-workspace i use and compiled into the projects cod.

But: The resource file is not updated on the device (it works on the simulator).
I added five new keys to the resource file, recompiled the application and loaded it on the BB.
Each time i try to use one of the new resource keys i get a MissingResourceException.

Is it possible that the application uses the resource file from another cod? Because each of my applications has a resource file with the same name, together with its unique named own one.

I hope i was able to clarify the issue, if not feel free to ask more Smiley Happy
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Resource files used by multiple applications

If the resource file is part of the project for your application, it should be built into the cod file for the application.  Having resource files of the same name in another project should not have any affect (assuming the other project is not referenced by this application).

 

Am I correct to assume that your application is contained in a single cod file (it doesn't reference other cod files)?

 

Are you using different versions of the BlackBerry JDE to create, edit and/or build the application?  The way resource files are stored and handled has changed in different versions of the BlackBerry JDE.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Resource files used by multiple applications

yes, my application is contained in a single cod. no other cod-files are referenced, except the ksoap2-library in some cases (which should be irrelevant).

each application is only maintained in a single OS version, most use 4.2.1
I have a few applications using 4.6 though and they also use the mentioned resource files.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
BlackBerry Development Advisor
Posts: 15,727
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: Resource files used by multiple applications

Do you have multiple projects active when you are testing this in the BlackBerry Simulator?  If so, please run clean.bat (located in the simulator directory), activate only the project you are working on and test it in the BlackBerry Simulator.

 

Is the BlackBerry Simulator running the same BlackBerry handheld software as the device you are testing on?

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
New Developer
Posts: 15
Registered: ‎08-21-2009
My Device: Not Specified

Re: Resource files used by multiple applications

[ Edited ]

I'm seeing this problem too.  In my case I compiled app A with different resource text under a new module name B, so that I had 2 different versions of the app - A and B - on the simulator.  I then changed the module name back to A in my project and continued work.  This is the only project in my Eclipse workspace.

 

What happened then is that code changes I make took effect in app A, but the app still tried to read the resource text from module B, throwing a MissingResourceException for anything I added since I abandoned module B.

 

Running clean.bat has fixed this for now, by deleting module B for me.

 

I had previously tried removing module B from the simulator Options / Advanced Options / Applications / Modules (it always said the module was in use), cleaning the project (no effect), and in the Eclipse IDE BlackBerry / Erase Simulator File / Erase All (modules A and B both came back every time).

 

The conclusion I came to is that the BlackBerry must access the resource text differently to the Java class files, etc.  Perhaps it looks up resources using the Java package name?  Both versions of my app use the same package names internally so that would make some kind of sense.

 

I would actually like to understand this better, as my client wants to run differently branded versions of the same app on the same device.

 

Edit: This is using Eclipse JDE Plugin 1.0.0.67, compiling and running on simulator as 4.2.1, also seen on 4.3

 

Developer
Posts: 179
Registered: ‎06-15-2011
My Device: Storm 9550
My Carrier: Vodaphone

Re: Resource files used by multiple applications

Hi 

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: Resource files used by multiple applications

we have solved this issue with a workaround only.

my research indicates that resources are stored globally on the device.
if several applications try to use the same resource package in different versions (in our case we copy a shared resource bundle into the project) they all use the same version.
it seems that the used version is determined alphabetically, but i am not sure about that.

to solve this we have introduced a versioned name of our shared resource, when we change something we change the package name to include the new version number - or generally speaking, we load another resource package onto the device.

In addition we have built a backup mechanism into classes using the resource file, catching MissingResourceExceptions and using a hardcoded English string in this case.
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 172
Registered: ‎01-02-2012
My Device: 8520 curve
My Carrier: compny

Re: Resource files used by multiple applications

Hi simon 

 

  i am also getting the problem here  

  i am using same resource file with same key and with diffrent value in two application and while i am installing it in to device i am getting the value of first installed app resource file.

 

 how to solve it  i am not getting any idea