Android – how to move to another activity in seconds?

I have a splash screen. I just want it to wait 1 or 2 seconds and then move on to the next activity. I know there are many methods, including handler classes and java.util.timer implementation. But this is the simplest and easiest method. Thanx advance

resolvent:

Use the following code

Splash_ Screen_ Activity.java

public class Splash_Screen_Activity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_screen);

        final Handler handler = new Handler();
        handler.postDelayed(new Runnable() {
            public void run() {
                // TODO: Your application init goes here.
                Intent mInHome = new Intent(Splash_Screen_Activity.this, InvoiceASAPtabactivity.class);
                Splash_Screen_Activity.this.startActivity(mInHome);
                Splash_Screen_Activity.this.finish();
            }
        }, 3000);
    }
}

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>