how to display an activity automatically after 5 seconds

后端 未结 4 1879
梦如初夏
梦如初夏 2020-12-12 23:29

In my application I have created a splash screen type of thing in android. It should remain for 5 seconds. My problem is that how I display another activity automatically af

4条回答
  •  旧巷少年郎
    2020-12-13 00:26

    new Handler().postDelayed(new Runnable() {
                @Override
                public void run() {
                    final Intent mainIntent = new Intent(LaunchActivity.this, HomeActivity.class);
                    LaunchActivity.this.startActivity(mainIntent);
                    LaunchActivity.this.finish();
                }
            }, 5000);
    

提交回复
热议问题