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
Highlighted
New Developer
Posts: 20
Registered: ‎08-14-2008
My Device: Not Specified
Accepted Solution

SIngleton and BlackBerry - help needed

Hello all ,

 

I was wondering :

If i want to ensure that only one instance of my application is operating - should i use Singleton Pattern or does the operating system of BB takes care of that ?

If i start it in the emulator once , will it be uploaded every time i will re-compile and re-run it? (i mean thefirst run)

My App is a PhoneListener App with some gui , nothing fancy .

 

Thanx!

 

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: SIngleton and BlackBerry - help needed

You have to work pretty hard to get two instances of your application running on the BlackBerrySmiley Wink

 

 

New Developer
Posts: 20
Registered: ‎08-14-2008
My Device: Not Specified

Re: SIngleton and BlackBerry - help needed

So there can be only one .

But when i re-run the emulator , and my app was on the previous run , will it shut down automatically before i use it again?

Developer
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: SIngleton and BlackBerry - help needed

Not sure I understand the question.

 

When you run the emulator, your app is either started during the boot process (if you have set the autostart option in your project), or it is not. Every restart of the simulator is basically the same as booting the device.

 

If you do not have the autostart property set, then your application will be started when you click on the icon. If you exit the application and the click on the icon again, your application is restarted.

 

You can keep your application running in background of you override the close() method in your top-level screen and perform a "requestbackground()". Then your application is reentered through the "activate()" method rather than being restarted.

 

All of this is covered faily well in the RIM Software Development guide and in the sample applications shipped with the JDE.