即使我按下后退按钮,我的计时器仍在运行,并且在指定时间后执行下一个活动。我该如何阻止这个?飞溅.java:
package com.ultimate.biggboss;
import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.widget.VideoView;
public class Splash extends Activity{
VideoView vid;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
vid = (VideoView)findViewById(R.id.video);
String urlpath="android.resource://" + getPackageName() + "/" + R.raw.logoanimate;
vid.setVideoURI(Uri.parse(urlpath));
vid.start();
Thread timer = new Thread(){
public void run(){
try{
sleep(4400);
} catch (InterruptedException e){
e.printStackTrace();
}finally{
Intent openHome = new Intent(Splash.this, main.class);
startActivity(openHome);
finish();
}
}
};
timer.start();
}
}
按下后退按钮后,我要编写什么代码以及在此类中的何处停止应用程序?