• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How can I make my app pause for 5 seconds?

GIR

Member
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:
int pause = 15; 
        int startTime = 0;
		while ( System.currentTimeMillis() <= startTime + (pause * 1001)){ 
                       if (System.currentTimeMillis() >= startTime + (pause * 1001)) { 
                       }}

Thanks in advance,
GIR
 
You can try using Thread.sleep(5000) like this:
try { Thread.sleep(5000); }
catch (InterruptedException ex) { android.util.Log.d("YourApplicationName", ex.toString()); }
 
Back
Top Bottom