Delay splash screen? Crash on SetTimeout?

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

I tried:


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…).

9 Answers

  • Accepted Answer

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

    setTimeout(function() {;
    }, 5000);
    — answered 6 years ago by Dan Giulvezan
    • 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 4 years ago by Brent Wood
    • thanks, worked for me

      — commented 3 years ago 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('', 100);

      — commented 3 years ago by Alfredo Schiappa
    • meaning, of course,

      setTimeout(, 100);

      — commented 3 years ago 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 3 years ago 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.

  • That would be another way to do it. However, the spashscreen stays up until I call Why can't I just wait for a bit with that?

  • The splash screen closes as soon as it enters line 1 of the coding, which in your case was "setTimeout".

  • 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….

  • Yea, you're right, I apologize. I'm with you here, this makes no sense..

  • Awesome. No idea why it doesn't work with the direct call, or with a real function. I did try:

    function opentabs() {;

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

    — answered 6 years ago by Martijn Pannevis
    1 Comment
    • give a function pointer, not the result value. ie:

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

      — commented 3 years ago by Ronald van Woensel
  • 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