Sunday, July 24, 2011

Re: [android-developers] CountDownTimer too slow ???

The calls to onTick are synchronized, maybe your code is taking more than a second to execute. Log can be expensive, and with debug symbols enabled your code will run a little bit slower than in real life.

Or maybe the end of times is close!! :P

On Sun, Jul 24, 2011 at 2:30 PM, Christophe <christophe.lebesnerais@gmail.com> wrote:
Run the following code in the emulator and start a chronometer at the
same time :

// log some text each second :
CountDownTimer countDown = new CountDownTimer(Integer.MAX_VALUE, 1000)
{
               private int i = 0;
               @Override
               public void onTick(long millisUntilFinished) {
                               Log.i("####", "###" + i);
                               i++;
               }
               @Override
               public void onFinish() {}
};

countDown.start();

Then wait a few minutes.
For example I stop when my chronometer was at 7min44s. The value in
the log was 448seconds => 7min28s.

WTF ?!???

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate