【发布时间】:2010-02-15 10:20:16
【问题描述】:
Intent helloservice = new Intent(this, HelloService.class);
startService(helloservice);
...
stopService(helloservice);
为什么这不起作用?它只是继续运行。我是否缺少一些绑定或什么?
顺便说一句,这是我的服务:
public class HelloService extends Service {
private Timer timer = new Timer();
private long INTERVAL = 1000;
public void onCreate() {
super.onCreate();
startservice();
}
private void startservice() {
timer.scheduleAtFixedRate( new TimerTask() {
public void run() {
Log.d("service", "This proves that my service works.");
}
}, 0, INTERVAL);
; }
@Override
public IBinder onBind(Intent arg0) {
return null;
}
}
【问题讨论】:
标签: java android service debugging