Zoom

Stopwatch Chronometer

I'm trying to make a stopwatch for android as part of a score board app the problem is I'm not sure how to use the chronometer to start, stop, then resume from the time it stopped at or reset to 0. The only problem is that I'm not sure how to use the setBase and getBase methods properly.

public class MainActivity extends Activity { int homecount, awaycount, minutes, seconds; TextView home, away; Button stop, start, reset, addhome, subhome, addaway, subaway; TextView time; public boolean running; Chronometer MyChronometer; long startTime, stopTime; running = false; stopTime=0; stopTime=0; MyChronometer = (Chronometer) findViewById(R.id.timer); start.setOnClickListener(new View.OnClickListener { public void onClick(View v) { ((Chronometer) findViewById(R.id.timer)).start; startTime=System.currentTimeMillis; running = true; } }); stop.setOnClickListener(new View.OnClickListener { public void onClick(View v) { ((Chronometer) findViewById(R.id.timer)).stop; stopTime=System.currentTimeMillis; running = false; } }); reset.setOnClickListener(new View.OnClickListener { public void onClick(View v) { } });

Source: stackoverflow.com
RELATED VIDEO
Replica Breitling Navitimer Heritage Chronometer Stopwatch [
Replica Breitling Navitimer Heritage Chronometer Stopwatch [
Chronometer Example Android Studio Stopwatch
Chronometer Example Android Studio Stopwatch
Chronometer Stopwatch Animated (Hd)
Chronometer Stopwatch Animated (Hd)
RELATED FACTS
Share this Post

Related posts

Rolex Oyster Perpetual Superlative Chronometer Cosmograph

Rolex Oyster Perpetual Superlative Chronometer Cosmograph

NOVEMBER 17, 2019

Ref. 16519, White Gold Cosmograph Daytona Rolex, “Oyster Perpetual, Superlative Chronometer, Officially Certified, Cosmograph…

Read More
Time Keeping devices

Time Keeping devices

NOVEMBER 17, 2019

If you’ve ever been to Rome, or seen pictures of this magnificent city, then you’ll have seen one of the many obelisks that…

Read More