Hi,
I am using a Timer in my android application, but i can't get it to
work. When I start my application the Timer simply does not start. The
application continues but does not update.
The long "toStart" finds the number of seconds left of the current
minute, and thereafter the period is set to 60 seconds. The TimerTask
simply calls a method.
This is the first part of the class containing the Timer:
public class infoUpdate extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Calendar cal = Calendar.getInstance();
updateTime();
long toStart = ( 60 - cal.get(Calendar.SECOND) ) * 1000;
Timer firstTimer = new Timer(false);
firstTimer.schedule(new TimerTask() {
@Override
public void run() {
updateTime();
}
}, toStart, 60000);
}
---------
Thank you very much,
//Kaloer
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---