BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 02-03-2010, 09:47 AM   #1 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2009
Model: 8300
PIN: N/A
Carrier: Rogers
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Exclamation Refreshing a screen? Please help :)

Please Login to Remove!

Hey all,

I'm fairly new to BB development. I have created a small phonelist app. When it first loads it downloads a bunch of names and phone numbers from the web. It displays this info on the screen.

A user is able to edit the data. When they do, I open a new window (over top of the first window) and they make the changes there. After they click save, it saves the info to the database (over the web). I then close that window.

After that window closes I am left with the first window (that had the original data). This window's data is now old and doesn't show the new changes that were made.

How can I refresh this screen? I'm assuming the second window that was opened has to call a function in the original window... is there an easy way?

Thanks in advance!

Ryan
Offline  
Old 02-03-2010, 12:53 PM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Mar 2008
Location: Austin, TX
Model: 9700
PIN: N/A
Carrier: T-Mobile
Posts: 1,644
Post Thanks: 0
Thanked 34 Times in 33 Posts
Default

When the top screen is dismissed, the onFocus() method of the underlying screen is called. Put your refresh here.
Offline  
Old 02-03-2010, 03:29 PM   #3 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2009
Model: 8300
PIN: N/A
Carrier: Rogers
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thankyou, i'll give that a try
Offline  
Old 02-04-2010, 01:42 AM   #4 (permalink)
Knows Where the Search Button Is
 
Join Date: Apr 2009
Model: 8800
PIN: N/A
Carrier: Airtel
Posts: 31
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by RyanRitten View Post
Thankyou, i'll give that a try
In addition to using onFocus, you may want to set a dirty flag in your initial screen through the topmost screen in case there was a change made that needs refresh of the list on initial screen.
Offline  
Old 02-04-2010, 10:47 AM   #5 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2009
Model: 8300
PIN: N/A
Carrier: Rogers
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Cool

Hey guys, after googling a bit, it seems to say I need something like this for my mainscreen class. I can't seem to find out where to add it. It never gets called when i view the mainscreen.


Code:
protected void onFocus(int direction) {
        System.out.println("direction:"+direction);
}
Where does it go? Do i need to create a listener of some kind to call it?

thanks!
Offline  
Old 02-04-2010, 11:22 AM   #6 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2009
Model: 8300
PIN: N/A
Carrier: Rogers
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, I have got this to work if I add it inside an objectlistfield class. However, i want to add it to the mainscreen class. I can't figure it out.

bascailly, all I would like to do is call a function whenever the first screen in my app is ever viewed.
Offline  
Old 02-04-2010, 11:29 AM   #7 (permalink)
Knows Where the Search Button Is
 
Join Date: Jun 2009
Model: 8300
PIN: N/A
Carrier: Rogers
Posts: 43
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Or, even better.... is there a way to call a method from the parent window from within the child window?

I tried passing "this" to the child (a reference to the parent window) and doing

this.functionname() from the child but it didn't work.
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.