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

how to make a screen appear for some fixed amount of time..?

this is what i want to achieve..there is a display method..that will display a screen and a button..the screen should close in some time i.e how do i make it to dissapper.after may be 20 sec..and when the button is pressed or the screen times out the display method should return a int value..

 

pubic int display(){

 

//initialize screen...this screen should close in a fixed amount of time..

//initialize the button..this button when pressed should close the screen

//add the button

//push the screen

//when the screen closes due to timeout i.e the fixed amount of time or the button is pressed

//return some int value

 

}

 

i am not getting how to do this..

 

Regards,

kaddy

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

Re: how to make a screen appear for some fixed amount of time..?

you can start a TimerTask when the screen is displayed and close it in the tasks run method.
----------------------------------------------------------
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: 293
Registered: ‎02-25-2009
My Device: Not Specified

Re: how to make a screen appear for some fixed amount of time..?

Or you can start a new thread like this :

 

(new Thread(){ public void run() { try{ Thread.sleep(2000);} catch(Exception e) {} System.exit(0); } }).start;

 

~Amardeep

www.impetus.com

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

Re: how to make a screen appear for some fixed amount of time..?

system.exit quits the whole application, it does not close the screen only.
----------------------------------------------------------
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: 293
Registered: ‎02-25-2009
My Device: Not Specified

Re: how to make a screen appear for some fixed amount of time..?

yeah System.exit() will close the application. he can use other methods here according to his requirement like , getUiApplication().popscreen() if he wants to pop the current screen or something like that.
Highlighted
Developer
Posts: 30
Registered: ‎05-07-2009
My Device: Not Specified

Re: how to make a screen appear for some fixed amount of time..?

Even better, create a Runnable whose run() method invokes UiApplication.popScreen() and then pass that Runnable to Application.invokeLater(Runnable runnable, long time, boolean repeat). The "time" parameter can be used to specify the "number of milliseconds to wait before adding the runnable object to the event queue".
New Developer
Posts: 14
Registered: ‎07-30-2009
My Device: BB 8820 - BB Bold 9700

Re: how to make a screen appear for some fixed amount of time..?

You can try the tips from this KB, i think that the idea of splash screen is same same with your problem.

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800256/... 

--
pKt