I need a regular method in my application. The problem is this: the next timer in the code performs its action only once. And the timer does this only (once) if I take an action (tap the display) after a lapse of time (2000). Do you know what I mean? Maybe it is. to do with "OnTouchListener"?
public class DrawView extends View implements OnTouchListener {
Timer mTimer = new Timer();
public DrawView(Context context) {
mTimer.schedule(new Task(this), 2000);
}
public boolean onTouch(View view, MotionEvent event) {
}
}
class Task extends TimerTask {
private DrawView mDw;
public Task(DrawView dw){
mDw = dw;
}
public void run() {
mDw.newgame();
}
}
source
share