我有一个闪屏活动SplashScreenActivity.java
,它会显示几秒钟。
同时,它启动了另一个活动HomeActivity.java
,该活动进行一些处理并需要几秒钟来加载。
//Start a new activity in the BG
Intent i = new Intent(this, HomeActivity.class);
//i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
this.startActivity(i);
//Remove this activity after few seconds so the HomeActivity shows in the FG
Timer timer = new Timer();
timer.schedule(new TimerTask() {
@Override
public void run() {
finish();
}
}, 2000);
如何在不将HomeActivity带到前台的情况下启动它?