Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.44 KB

README.md

File metadata and controls

49 lines (39 loc) · 1.44 KB

BataTime

A simple Android Timer library

Getting started

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

How to use

You can do this in two ways:

1: Without tick timer - uses default tick time 500 miliseconds
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..." );
    }
});
2: With tick timer
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..." );
    }
});

Projects using this library

1: Jifunze Android app - App on Google Play

2: Kamba Music - App on Google Play