How can I make my app pause for 5 seconds?

Discussion in 'Application Development' started by GIR, Nov 12, 2010.

  1. GIR

    GIR Well-Known Member
    18

    Feb 14, 2010
    96
    10
    18
    Classified.
    UK
    Hello again,

    Ive been trying many combination of examples (yes - im still learning), but so far ive been unable to make my program pause for 5 seconds.

    My goals is this:

    Display a picture for 5 seconds, then display buttons.

    The only thing that is different from other examples ive seen is that the content is produced dynamically on the screen, no xml is used.

    Can anyone please help?

    Ive been trying different examples, but none seem to simply pause the program without making the app force close.

    The current method im trying is:
    Code (Text):
    1.  
    2. int pause = 15;
    3.         int startTime = 0;
    4.         while ( System.currentTimeMillis() <= startTime + (pause * 1001)){
    5.                        if (System.currentTimeMillis() >= startTime + (pause * 1001)) {
    6.                        }}
    7.  
    Thanks in advance,
    GIR
     

    Advertisement
  2. miXer

    miXer Well-Known Member
    53

    Aug 12, 2010
    313
    51
    53
    Norway
    You can try using Thread.sleep(5000) like this:
    try { Thread.sleep(5000); }
    catch (InterruptedException ex) { android.util.Log.d("YourApplicationName", ex.toString()); }
     
  3. id0001

    id0001 Well-Known Member
    38

    Apr 20, 2010
    142
    23
    38
    Student.. also software developer
    Netherlands
    GIR likes this.

Share This Page

Loading...