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: 86
Registered: ‎10-28-2010
My Device: Blackberry Curve, Bold and Strom
My Carrier: Vodafone

How to put Application in background

Hi All,

 

           It's Neeraj chauhan here. I want to make an application in blackberry. And my problem is This.......

 

when I clicked on esc key instead of closing the application, my application should go in background and when i again click on that application application should be start from last position wher i pressed the esc key..

 

Actully this application make for downloading an audio or video. So when we start download a video or audio it take some time to download the audio or video. So i want to put this aaplication is background and also this application must be continuously run. When i again start this application app should be start from it's running mode.

 

 

Can anyone help, how to make this type of application..

Thanks & Regards
Neeraj Chauhan
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to put Application in background

UiApplication.getUiApplication().requestBackground();

 

Try it and see what happens. 

Developer
Posts: 86
Registered: ‎10-28-2010
My Device: Blackberry Curve, Bold and Strom
My Carrier: Vodafone

Re: How to put Application in background

Thanks Peter,

 

       But if i am using this UiApplication.getUiApplication().requestBackground(); application is go to background but when i again start the application it start from begining. 

 

so that i used following code

 

 

RuntimeStore runtimeStore = RuntimeStore.getRuntimeStore();
      Home _myApp;
             _myApp = (Home)runtimeStore.get(APP_ID);
          if (_myApp != null) {
              System.out.println("Forground" );
              _myApp.requestForeground();
          } else {
              System.out.println("Create" );
              _myApp = new Home();
              runtimeStore.put(APP_ID, _myApp);
              _myApp.enterEventDispatcher();
              System.out.println("dispatched" );
          }
      

 

Thanks & Regards
Neeraj Chauhan
Highlighted
Developer
Posts: 19,636
Registered: ‎07-14-2008
My Device: Not Specified

Re: How to put Application in background

I suspect you are not using it correctly.

 

Try just having a menu item that just does the requestbackground() and see what happens with that.

 

I am not suggesting this is the solution to your problem. 

 

I am suggesting that it will work and the fact that it doesn't work for you now is because of other processing that goes on when you press ESC.  So by doing this as a menu item, you will test and see it does work and so know that you have to fix your code processing the ESC.