BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 04-10-2008, 10:29 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8300
PIN: N/A
Carrier: O2
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Passing values back to a screen lower on the stack?

Please Login to Remove!

I have a screen with some fields and I open another screen. When this new screen closes I want it to pass some strings back to the previous screen to put in the fields.

At the moment I pass references of the fields into the new screen constructor and use the setText methods on them when closing the screen. This works but I can't help but feel there's a better way of doing it.

Any ideas?

Thanks
Offline  
Old 04-10-2008, 11:30 AM   #2 (permalink)
Talking BlackBerry Encyclopedia
 
richard.puckett's Avatar
 
Join Date: Oct 2007
Location: Seattle, WA
Model: 9020
PIN: N/A
Carrier: T-Mobile
Posts: 212
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

You want to separate your model and your views (MVC).

Both of your screens (views) will reference the same data model: screen1 might pull data from the model for display, and screen2 might accept input from the user and populate the data model (which screen1 could then use when screen2 gets popped off the stack).
__________________
Do your homework and know how to ask a good question.
Offline  
Old 04-15-2008, 11:08 AM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Mar 2008
Model: 8300
PIN: N/A
Carrier: O2
Posts: 17
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks, i've sort of implemented that successfully. Unfortunately I was too far on with it to quickly separate the model but I was easily able to do the controller side of it directly interacting with the fields to see if it would work.
Thought it would only need the 1 screen as the proof of concept so kept everything together to be simple, but they've liked what they've seen and wanted another couple of big features under the proof of conept to see what could be done. I'll have to go back and do it properly once I get out of the proof of concept stage.

Cheers.
Offline  
Old 04-15-2008, 11:17 AM   #4 (permalink)
CrackBerry Addict
 
Join Date: Jun 2005
Location: Manchester, UK
Model: BOLD
Carrier: t-mobile
Posts: 714
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

use onExposed(), when the bottom screen is exposed it can update it's data.

public void onExposed(){
//repopulate fields
}
__________________
new job doesn't allow a public profile - please do not contact this user with questions, you will not get a response. good luck!
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.