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: 218
Registered: ‎02-20-2009
My Device: Not Specified

Show screen only on first start up of application ????

Hi,

 

What we are trying to do is that when we first start up the application ,

 

it should show the "sampleScreen" screen. (only on first start up).

 

All the other times when user start the application , it should give the menu as it is.

 

 

If anyone has an idea about that. Please help me in this matter.

 

 

Thanks & Regards,

Narendra Shekhawat.

Developer
Posts: 40
Registered: ‎08-21-2008
My Device: Not Specified

Re: Show screen only on first start up of application ????

You can make RMS entry to accomplish this task. On each startup of your application read RMS entry and show your screens acordingly. This is bit tricky but simple.

public static void main( String[] args ) { // Perform additional work as part of main method if necessary. if( ApplicationManager.getApplicationManager().inStartup() ) { // Add a system listener to detect when system is ready and available. applicationInstance.addSystemListener( applicationInstance ); } else { // System is already ready and available so perform your start up work now. // Note that this work must be completed using invokeLater because the // application has not yet entered the event dispatcher. applicationInstance.doStartupWorkLater(); }

// Enter the event dispatcher. applicationInstance.enterEventDispatcher(); }

 

/** * Implementation of the powerUp method for the SystemListener interface * */ public void powerUp() { applicationInstance.removeSystemListener( this ); doStartupWork(); }

 

/** * Perform the start up work on a new Runnable using the * invokeLater construct to ensure that it is executed * after the event thread has been created. * */ private void doStartupWorkLater() { applicationInstance.invokeLater( new Runnable() { public void run() { doStartupWork(); } }); }

 

/** * Your private method for performing your startup work. * */ private void doStartupWork() { // Perform your start up activities here! //Read RMS here and choose to push required screen.

}

 

 

This process may help you. If you still got some problem then please read following KB of artical : DB-00539 : How To - Display a GUI when the BlackBerry device starts up

 

Raks
Developer
Posts: 745
Registered: ‎01-04-2009
My Device: 8300, 8800, 8700f, 9000

Re: Show screen only on first start up of application ????

hi, i also needed some time ago to show different screens when user runs app for the first time and different one when he runs it for the second (or later) time. i do not know if my solution will be usefull for You, but i did it that way:

in my application i always ask user about application privileges and ask him to set everything to 'allow'. i show the screen for the first run of application and set a proper variable, which means that all privileges were set. another run of application check if variable is set - if it is, it means that we were in app, so we can show another screen..

 

this variable always checks if all privileges are set to allow. if they are-then variable is set (we were in the app once), if privileges weren't check, then also variable isn't set-first time in app.

 

i hope i described it clearly.

 

kind regards

Developer
Posts: 218
Registered: ‎02-20-2009
My Device: Not Specified

Re: Show screen only on first start up of application ????

Thanks both of you.

 

Thanks a lot.

 

What  I have done so far is that  used a persistenceObject and set a variable in it.

 

and according to value of this variable, I can check the startup no.

 

hence perform the specific task.

 

is this the rigth way to do.

 

is there any problem to use this approach . this is working fine according to requirement , but I dont know

 

the side effects of this approach (if any).

 

 

Please guide me in this matter.

Developer
Posts: 40
Registered: ‎08-21-2008
My Device: Not Specified

Re: Show screen only on first start up of application ????

Yes. persistenceObject is another approch to do what you need.
Raks