I would like to know what exactly the difference is between these two classes, and when should I use each.
I am asking this because I am wondering about this sample code:
mStatusChecker = new Runnable() {
@Override
public void run() {
invalidate();
mHandler.postDelayed(mStatuschecker, (long) increment * 1000);
}
};
If I put the mHandler.postDelayed
line of code before invalidate()
, the Runnable
is executed at almost double the speed. I am wondering if a Timer
could be used instead to fix this problem.