1. Using the Thread class
New Thread () {
@Override
public void Run () {
try {
3 seconds delay
Thread.Sleep (3000);
} catch (Interruptedexception e) {
E.printstacktrace ();
}
Interface Jump
Intent Intent = new Intent (mainactivity.this,content.class);
StartActivity (Intent);
Destroys the interface before the jump, which is used to set the exit without stepping back to the page when the return key is pressed.
Finish ();
}
}.start ();
2. Use timer (timer) with TimerTask
Timer timer = new timer ();
Delay 3 seconds to implement interface jump
Timer.schedule (New TimerTask () {
public void Run () {
/interface Jump
Intent Intent = new Intent (mainactivity.this,content.class);
StartActivity (Intent);
Destroys the interface before the jump, which is used to set the exit without stepping back to the page when the return key is pressed.
Finish ();
}
},3*1000);
The schedule method of the timer is introduced:
[Android] Two common ways to implement delay in a program