A simple Android Timer library
A library should be small, right?!!! :)
Copy the two java files in the Library dir and paste them in your project package and you are good to go
You can do this in two ways:
int timeMiliseconds = 2000;
new BataTime(timeMiliseconds).start( new BataTimeCallback() {
@Override
public void onUpdate(int elapsed) {
Log.e( TAG, "On update called...time elapsed = "+elapsed );
}
@Override
public void onComplete() {
Log.e( TAG, "On complete called..." );
}
});
int timeMiliseconds = 2000; // in milliseconds = 2seconds
int tickTime = 1000; // in milliseconds - 1 second - we trigger onUpdate in intervals of this time
new BataTime(timeMiliseconds, tickTime).start( new BataTimeCallback() {
@Override
public void onUpdate(int elapsed) {
Log.e( TAG, "On update called...time elapsed = "+elapsed );
}
@Override
public void onComplete() {
Log.e( TAG, "On complete called..." );
}
});
1: Jifunze Android app - App on Google Play
2: Kamba Music - App on Google Play