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
enil
Posts: 35
Registered: ‎11-26-2008
My Device: 8100

pushScreen problem... plz help asap

Hi All,

 

i have created one application that flows with 3 pages

i can go back and forth among pages

like below

------------------

screen1(default)

------------------

page1          

 

go ahead (button) - when i click on this button, it will push screen 2

 

------------------

 

------------------

screen2

------------------

page2        

 

go ahead (button) - when i click on this button, it will push screen 3

go back  (button) - when i click on this button, it will push screen 1

 

------------------

 

 

------------------

screen3

------------------

page3          

 

go back (button) - when i click on this button, it will push screen 2

 

------------------

 

 

 

i have implemented 'pushScreen'

 

it is working fine

 

my problem is eveytime i have to do popScreen before pushScreen if that screen already been pushed

so everytime screen got rendered again and again

i.e if i m on screen 2, and i click on  'go back' button,

i have to remove screen 1. becuase we can not push same screen again.

and then push screen 1 again.

 

so i wanna know if there is something like show and hide screen from display stack.

so everytime i do not have to remove and push same screen again

i just have to show and hide like DIV in HTML

 

there is no problem for small application like this. going back and forth.

for some application, like XML parsing, database connection etc

all these stuff happen again and again. so may take more time to show response.

 

please help me ASAP

 

Thanks,

Anil

 

 

 

 

Please use plain text.
Developer
simon_hain
Posts: 16,187
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: pushScreen problem... plz help asap

it would be helpful if you could use normal english.

if you push a second screen the first is still on the display stack. if you pop the second screen the first will be re-displayed.
----------------------------------------------------------
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
Please use plain text.
Developer
enil
Posts: 35
Registered: ‎11-26-2008
My Device: 8100

Re: pushScreen problem... plz help asap

i can not push same screen again if that screen is in display stack

 

so what if i want to go on screen which is already in display stack ?

 

i have to remove it from display stack then have to push it again

 

and i do not want to do this

and why should i do this again

 

i am in search of such thing that retrieves  screen from display stack

and simply show it instead of reloading (repaint) it

 

 

Please use plain text.
Developer
simon_hain
Posts: 16,187
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: pushScreen problem... plz help asap

if you pop screen2 the first screen is displayed again. there is no need to push it again.
----------------------------------------------------------
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
Please use plain text.
Developer
enil
Posts: 35
Registered: ‎11-26-2008
My Device: 8100

Re: pushScreen problem... plz help asap

thanks simon for your responses...

you are right...

 

but again i have to push screen 2 if i want to show it

 

what you want to tell is below:

 

i have two screens in display stack (LIFO)

---------

screen 2

screen 1

 

assume that right now i am on screen 2

if i want to go on screen 1 , i have to remove screen 2

so automatically it will show screen 1

 

 

now my display stack will be like this

---------

screen 1

 

now if i want to go on screen2, i have to push it

now i am pushing it and display stack will be like this

---------

screen 2

screen 1

 

you can see here that screen 2 is pushed twice

 

so what if i just do following thing instead above one:

 

 

i have two screens in display stack (LIFO)

---------

screen 2

screen 1

 

assume that right now i am on screen 2

if i want to go on screen 1 , i just hide screen 2

so screen 1 will be shown

 

my stack will remain same as it was. 

no pushing. no popping. and my purpose is achieved.

 

i know this is wrong in multiple screens.

in multiple screen case, we need to pass index of screen in stack 

so we can do easily hide or show that particular screen.

 

but is there something like hide and show screens ?

so we do not have to push and pop same screen again and again

 

 

 

 

 

Please use plain text.
Developer
peter_strange
Posts: 19,607
Registered: ‎07-14-2008
My Device: Not Specified

Re: pushScreen problem... plz help asap

There is no hide/show in the API - you do have to push/pop every time.

 

I wouldn't worry about the overhead of the rendering - the device renders the screen every time you press the menu button anyway so this processing is not slow.

 

You seem to be concerned about other processing related to creating the screen.  Remember you do not have to recreate the screen.  You can create the screens once, put them in an array, have an index into this array, and push/pop based on the from/to index.  So the only overhead is the push, i.e. the rendering of the new screen, which as noted, is fast enough.

 

Have you thought about other options.  For example, typically BlackBerry applications have long screens rather than multiple screens, so perhaps you don't need threee screens.  You could have one long screen and provide the user with a quick way to get to the top/bottom/middle of the long screen.

Please use plain text.
Developer
enil
Posts: 35
Registered: ‎11-26-2008
My Device: 8100

Re: pushScreen problem... plz help asap

thanks peter and simon for your prompt response with helpful details

 

 

:smileyhappy:

Please use plain text.