Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Close a Window after a new Window is fully loaded

When I use:

newWindow.open();
currentWindow.close();

There is a split second of black on my Android device as one window closes and the other opens. Is there a way I can listen for newWindow to completely load before closing currentWindow?

Thanks!

— asked August 13th 2010 by Chris Schultz
  • android
  • close
  • load
  • open
  • window
0 Comments

4 Answers

  • Accepted Answer

    Windows cannot be "removed" only "closed".

    You could try to add a small delay when you close the window.

    
    newWindow.open();
    setTimeout(  function(){
        the_win_to_be_closed.close();
    } , 100)
    
    — answered August 13th 2010 by Dan Tamas
    permalink
    0 Comments
  • This is pretty much the same problem I posted about earlier today, just on iphone. Can someone hop in here and explain removing windows from the hierarchy? What page in kitchensink calls .remove() on a window? Because I can't find it. And when I call a window to be removed the app just flat out crashes. I know there are other posts about closing multiple windows but that does not seem to be working for many people.

    — answered August 13th 2010 by Kevin Ripka
    permalink
    0 Comments
  • You shouldn't need to automatically call remove on a window most of the time - Titanium will clean that up for you. Windows are really best used for hierarchical navigation with a clear forward/back navigation mechanic. If you need to skip back and forth between a collection of screens, a stack of views is usually a better choice.

    — answered August 13th 2010 by Kevin Whinnery
    permalink
    0 Comments
  • I'm not trying to call a .remove I'm calling a .close. I will try doing to the timeout function and see how that works.

    Thanks.

    — answered August 13th 2010 by Chris Schultz
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.