Created
August 8, 2009 01:07
-
-
Save gimite/164255 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Timer; | |
import java.util.TimerTask; | |
import android.app.Service; | |
import android.os.Handler; | |
public class MyService extends Service { | |
private Handler handler = new Handler(); | |
private Timer timer; | |
public void onCreate() { | |
super.onCreate(); | |
timer = new Timer(); | |
timer.schedule(new UpdateTask(), 0, 300); | |
} | |
private class UpdateTask extends TimerTask { | |
public void run() { | |
handler.post(new Runnable() { | |
public void run() { | |
// 実際の処理... | |
} | |
}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment