这是我的第一个活动,当我按下电话中的后退按钮时,应用程序关闭,但第二个活动即使在关闭后也弹出!可能是因为线程仍在运行?但我试图摧毁它,但无济于事!任何建议应用程序即使在关闭后也会启动
protected void onCreate(Bundle myclass) {
super.onCreate(myclass);
setContentView(R.layout.splash);
timer = new Thread() {
public void run() {
try {
sleep(3000);
} catch (InterruptedException e) {
e.printStackTrace();
}
finally {
Intent openStarting = new Intent("nik.tri.MENU");
startActivity(openStarting);
}
}
};
timer.start();
}
@Override
protected void onPause() {
super.onPause();
timer.destroy(); // tried timer.stop() as well
finish();
}
}