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
Contributor
Posts: 37
Registered: ‎07-23-2011
My Device: 9700
My Carrier: Airtel

Auto Run on Startup is not working

I want to show my home screen of my app(to autorun) on start up, I enabled the auto run in XML descriptor and  worked on the below code, But its not working, i hard reseted my Bold 9900 device my app doesn't opened.

Please help me.

 

package mypackage;
import net.rim.device.api.system.*;
import net.rim.device.api.ui.UiApplication;

class MyApp extends UiApplication  implements SystemListener {
 
    public static void main(String [] args) {

        MyApp appInstance = new MyApp();

       
        if (ApplicationManager.getApplicationManager().inStartup()) {
            appInstance.addSystemListener(appInstance);
        } else {
            appInstance.doStartupWorkLater();
        }
        appInstance.enterEventDispatcher();
    }

   
    MyApp() {}


        private void doStartupWorkLater() {
        invokeLater(new Runnable() {
            public void run() {
                doStartupWork();
            }
        });
     }


    private void doStartupWork() {
     UiApplication.getUiApplication().pushScreen(new MyScreen());
    }

    public void powerUp() {
        removeSystemListener(this);
        doStartupWork();
    }     

 public void batteryGood() {
  
 }

 public void batteryLow() {
  
 }

 public void batteryStatusChange(int status) {
  // TODO Auto-generated method stub
 
 }

 public void powerOff() {
  // TODO Auto-generated method stub
 
 }
 
}

 I am extended UiApplication in main class still the doesn't open on start up.

Highlighted
Developer
Posts: 656
Registered: ‎02-03-2010
My Device: Z10 LE
My Carrier: Rogers

Re: Auto Run on Startup is not working

Are you using Eclipse?  If so did you tick this option as in the image?Snapshot.jpg


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing