MEMORIAL DAY SALE: Save 15% on ALL BlackBerry Accessories! Use Coupon Code MEM12.
Join Our 3 MILLION+ Members Today! Register Here | Login
Go Back   BlackBerry Forums at CrackBerry.com > BlackBerry Professionals > App Developers

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
    Thread Author   #1  
Old 04-14-2009, 11:53 AM
CrackBerry Abuser
Device(s): 9700 (Bold)
Carrier: AT&T/Cingular
Pin: 21C3344D
 
Location: Ames, IA
Join Date: Feb 2009
Posts: 256
Likes Received: 0
Thanked 0 Times in 0 Posts
Default How to close a screen

So I have an app I'm writing (long time HDL/C/C++ programmer, not so much with the Java) and I have my main screen up (DeviceListScreen). I created a menu item to open a new screen (AddNewDeviceScreen) where the user enters data which will be saved into a list once the user closes this new window. To get this info from AddNewDeviceScreen into my main class's list I have overwritten AddNewDeviceScreen.onClose() to gather the info, put it in the list and then close and go back to DeviceListScreen. This is the issue.

I know this isnt exactly how the code looks but this is the idea.

MenuItem m_AddDeviceItem = new MenuItem(...)
{
void run()
{
DeviceListScreen dls = new DeviceListScreen();
UiApplication.getUiApplication().pushScreen(dls);
}
}

....

public boolean DeviceListScreen.onClose()
{
// Put data in list.

return true;
}

Whil I'm stepping through the code, the onClose() gets called and everything happens nicely, except the screen doesnt go away. Since I've overwritten the onClose method is there something else I need to do like a popScreen?
__________________
BlackBerry Addict in Iowa
PIN: 21C3344D
www.twitter.com/jeffparent
Reply With Quote Tip this Post
  #2  
Old 04-14-2009, 05:06 PM
CrackBerry Abuser
Device(s): 9000 (Bold)
Carrier: Vodafone
 
Join Date: Oct 2008
Posts: 494
Likes Received: 0
Thanked 1 Time in 1 Post
Default

Yes, you need to pop the screen. Read the API javadocs or find some sample code.
Reply With Quote Tip this Post
    Thread Author   #3  
Old 04-14-2009, 05:59 PM
CrackBerry Abuser
Device(s): 9700 (Bold)
Carrier: AT&T/Cingular
Pin: 21C3344D
 
Location: Ames, IA
Join Date: Feb 2009
Posts: 256
Likes Received: 0
Thanked 0 Times in 0 Posts
Default

I eventually figured out that I was not calling close() on the screen. That solved my problem.

Posted from my CrackBerry at wapforums.crackberry.com
__________________
BlackBerry Addict in Iowa
PIN: 21C3344D
www.twitter.com/jeffparent
Reply With Quote Tip this Post
Reply
BlackBerry Forums at CrackBerry.com > > BlackBerry Professionals > App Developers   How to close a screen

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes