Titanium Community Questions & Answer Archive

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

Delay splash screen? Crash on SetTimeout?

Hi!
I have an app where I want to keep the loading splashscreen longer than the default time. (don't ask…).

I tried:

setTimeout('tabGroup.open()',100);

However, this crashes the app on startup.
The only error I get is [DEBUG] Session did end with error (null).
Any insight on why it's crashing? And/or another way to have the splashscreen slow longer?
(yeah, I know it's a strange question. Client wants it that way…).

— asked May 19th 2010 by Martijn Pannevis
  • delay
  • iphone
  • settimeout
  • splash
0 Comments

9 Answers

  • Accepted Answer

    Give it a shot like this, seemed to work when I tried it:

    setTimeout(function() {
        tabGroup.open();
    }, 5000);
    
    — answered May 19th 2010 by Dan Giulvezan
    permalink
    5 Comments
    • Yup. worked for me. I would love to know why the direct call doesn't work.
      Plus, it would be great if the titanium version of the setTimeout function was documented just somewhere.

      — commented January 16th 2012 by Brent Wood
    • thanks, worked for me

      — commented November 12th 2012 by Khaled Kofahi
    • The direct call isn't working because you're not passing a function pointer, but you're simply calling a function. You should have written the function name without the '()', that's to say:

      setTimeout('tabGroup.open', 100);

      — commented January 12th 2013 by Alfredo Schiappa
    • meaning, of course,

      setTimeout(tabGroup.open, 100);

      — commented January 12th 2013 by Alfredo Schiappa
    • @ Alfredo - you do know you answered a year old comment on a 3 year old question, there are newer unanswered questions that could do with your ability to assist rather than the really old answered ones :)

      — commented January 12th 2013 by Malcolm Hollingsworth
  • Only way I can think of at the moment to make it visible longer would be to create an image view that looks just like the splash and have that be the first thing you see when the splash screen closes, then put your timer on that new image view.

    — answered May 19th 2010 by Dan Giulvezan
    permalink
    0 Comments
  • That would be another way to do it. However, the spashscreen stays up until I call tabgroup.open(). Why can't I just wait for a bit with that?

    — answered May 19th 2010 by Martijn Pannevis
    permalink
    0 Comments
  • The splash screen closes as soon as it enters line 1 of the coding, which in your case was "setTimeout".

    — answered May 19th 2010 by Sj Singh
    permalink
    0 Comments
  • Not entirely true: If I don't open the tabgroup (but do creat the tabs, etc), there are lines of code, but the splashscreen does stay up….

    — answered May 19th 2010 by Martijn Pannevis
    permalink
    0 Comments
  • Yea, you're right, I apologize. I'm with you here, this makes no sense..

    — answered May 19th 2010 by Sj Singh
    permalink
    0 Comments
  • Awesome. No idea why it doesn't work with the direct call, or with a real function. I did try:

    function opentabs() {
    tabGroup.open();
    }
    
    setTimeout(opentabs(),100);
    

    And that also crashes.
    Somehow, you'rs doesn't! Thanks!

    — answered May 19th 2010 by Martijn Pannevis
    permalink
    1 Comment
    • give a function pointer, not the result value. ie:

      settimeout(opentabs,100) instead of settimeout(opentabs(),100)

      — commented October 4th 2012 by Ronald van Woensel
  • Thanks, this worked for me also.

    — answered February 27th 2012 by Dimitrios Stamou
    permalink
    0 Comments
  • Hi. Thanks for the help guys. I would like to start off my app with an animated splash screen. The way I can think of right now is by setting the splash screen to the 0th frame and continuing the animation in image views. Is there a better mehod ? Also, how can i reduce the time of my splash screen.. Thanks

    — answered April 25th 2012 by Pavan Hemdev
    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.