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
sujithravindran
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified
Accepted Solution

Invalidating the previous screen

Hi Developers,

 

 

 

Im facing a problem.  I have 2 screen , from the first screen when button is pressed im calling the second screen , im also sending the first screen(this) to the second screen and from the second screen im trying to invalidate with the firstscreen object. even through i try to invalidate nothing is happening .

 

 

Can any one tell a soluiton for the same.

 

 

Thanks

SujithRavindranyes

 

Developer
simon_hain
Posts: 16,347
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Invalidating the previous screen

 

what exactly are you trying to achieve?

if the second screen is on top you will not able to see anything on the first one.

----------------------------------------------------------
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
sujithravindran
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified

Re: Invalidating the previous screen

Hi simon,

 

To be simple i need to invalidate a screen which on the top of the stack.

 

From the first screen on the button press im moving to the second screen . so now first screen is on the top of the  stack . now i will close the second  screen and try to invalidate the first one. but it is not working

 

 

a small briefing just to express what i want to tell . not a working code 


1) From the first screen im moving to the second screen

SosMessageScreen  sospredefinedmessageScreen = new SosMessageScreen(this);
			UiApplication.getUiApplication().pushScreen(sospredefinedmessageScreen);


2) From the second screen 

UiApplication.getUiApplication().popScreen(this);
objectoffirstscreen.invalidate

 Hope it is clear

 

Thanks 

SujithRavindran

 

 

Developer
simon_hain
Posts: 16,347
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Invalidating the previous screen

and what do you want to achieve with the invalidate?

----------------------------------------------------------
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
sujithravindran
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified

Re: Invalidating the previous screen

Hi simon,

 

After closing the  second screen certain values should be changed . I need to show the changed value by using invalidating .

Developer
simon_hain
Posts: 16,347
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport

Re: Invalidating the previous screen

invalidate does not change anything.

you have to call setText on textfields etc to set new values. this invalidates them automatically.

you can either write an update method (to call from screen2) or use on onUiEngineAttached to update the screen each time it is 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
Developer
sujithravindran
Posts: 261
Registered: ‎08-11-2009
My Device: Not Specified

Re: Invalidating the previous screen

Thanks Simon,

 

 

Hope this helps 

Regular Contributor
techie
Posts: 77
Registered: ‎05-21-2012
My Device: 9900

Re: Invalidating the previous screen

Hi Simon,

 

Can u guide how to use onUiEngineAttached for this same problem cited here programmatically or post some useful link.

Would much appreciate.

 

Thanks

 

Developer
lakshman9687
Posts: 243
Registered: ‎07-22-2011
My Device: BlackBerry Z10

Re: Invalidating the previous screen

Hi,

Here onUiEngineAttached is working if screen is attaching to main thread or stack and when screen is detaching,

it means u write onUiEngineAttached if(attached) that means screen is attaching and if(!attached) means screen is detaching..

 

 

Regards,
Lakshman K

----------------------------------------------------------
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.

Regular Contributor
techie
Posts: 77
Registered: ‎05-21-2012
My Device: 9900

Re: Invalidating the previous screen

Hi lakshman,

That was indeed a nice explanation. But where and how would i implement that UIEngine thing in the code i am still confused.Like shold it be in the second screen or first and how exactly to go about it

Much appreciate the help.

Thanks.