How to create Stopwatch

Quickly share your Android Code Snippets here...

How to create Stopwatch

Postby subbarao » Wed Mar 03, 2010 7:20 am

Hi...
I am developing an application with StopWatch. I created two buttons start and stop. when start button click the time starts and stop button clicks time stop and i need that perticular time. how is it possible... plz help me
subbarao
Freshman
Freshman
 
Posts: 6
Joined: Wed Mar 03, 2010 6:09 am
Location: Hyderabad

Top

Postby eduaquiles » Thu Apr 22, 2010 2:28 pm

2 ways:

1 - You can create a method, let's say... .click();
Every time you call it, it starts or stop the stopwatch and return the current time on the stopwatch.

2- Create an other method witch returns the current time. Since the stopwatch will be stopped, you'll get the correct time.
eduaquiles
Freshman
Freshman
 
Posts: 2
Joined: Thu Apr 22, 2010 2:14 pm
Location: Porto Alegre

Re: How to create Stopwatch

Postby Dwein » Fri Nov 11, 2011 8:30 am

This stopwatch consists of 3 labels called Label1, Label2, Label3 and 2 buttons called btnSart and btnExit.
1. Create 3 labels named Label1, Label2 and Label3.
2. Change the text of these labels to the number 0.
3. Create a Start/Stop button called btnStart.
4. Create an Exit button called btnExit.
5. Finally, create a timer called tmrTime. Make sure you change the timer interval to 1000 to represent 1 second. This can be placed anywhere in the form as it does not interfere with the cell phone spy software, it's design/object.
Dwein
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Nov 11, 2011 8:22 am

Top

Return to Code Snippets for Android

Who is online

Users browsing this forum: No registered users and 9 guests