Click here to Skip to main content
15,914,222 members
Home / Discussions / Java
   

Java

 
GeneralRe: why can't I figure out array input Pin
LORDA127-Nov-10 23:41
LORDA127-Nov-10 23:41 
GeneralRe: why can't I figure out array input Pin
Cedric Moonen7-Nov-10 23:54
Cedric Moonen7-Nov-10 23:54 
AnswerRe: why can't I figure out array input Pin
Luc Pattyn8-Nov-10 2:01
sitebuilderLuc Pattyn8-Nov-10 2:01 
AnswerRe: why can't I figure out array input [modified] Pin
Nagy Vilmos8-Nov-10 2:55
professionalNagy Vilmos8-Nov-10 2:55 
AnswerRe: why can't I figure out array input Pin
moxwose18-Nov-10 23:22
moxwose18-Nov-10 23:22 
QuestionAndroid Mobile Application Pin
Smaini Nurbs7-Nov-10 2:51
Smaini Nurbs7-Nov-10 2:51 
AnswerRe: Android Mobile Application Pin
Richard MacCutchan7-Nov-10 5:41
mveRichard MacCutchan7-Nov-10 5:41 
QuestionAndroid Stopwatch Pin
Smaini Nurbs7-Nov-10 2:46
Smaini Nurbs7-Nov-10 2:46 
Hi everyone,


I not really good with programming, so I need some help. Does anybody know how to create a stopwatch for an Android phone using Java programming? I don't know where to start. So this is what I have found so far. Thanks in advance for the help.


package com.novoda.runbuddy.activity;<br />
<br />
public class StopWatch {<br />
<br />
    private long startTime = 0;<br />
    private long stopTime = 0;<br />
    private long elapsed = 0;<br />
    private boolean running = false;<br />
<br />
<br />
    public void start() {<br />
        this.startTime = System.nanoTime();<br />
        this.running = true;<br />
    }<br />
<br />
<br />
    public void stop() {<br />
        this.stopTime = System.nanoTime();<br />
        this.running = false;<br />
    }<br />
<br />
    public void reset() {<br />
        this.startTime = 0;<br />
        this.stopTime = 0;<br />
        this.running = false;<br />
    }<br />
<br />
    //elaspsed time in microseconds<br />
    public long getElapsedTimeMicro() {<br />
        if (running) {<br />
            elapsed = ((System.nanoTime() - startTime) / 1000);<br />
        }<br />
        else {<br />
            elapsed = ((stopTime - startTime) / 1000);<br />
        }<br />
        return elapsed;<br />
    }<br />
<br />
    //elaspsed time in milliseconds<br />
    public long getElapsedTimeMilli() {<br />
        if (running) {<br />
            elapsed = ((System.nanoTime() - startTime) / 1000000);<br />
        }<br />
        else {<br />
            elapsed = ((stopTime - startTime) / 1000000);<br />
        }<br />
        return elapsed;<br />
    }<br />
}<br />

AnswerRe: Android Stopwatch Pin
TorstenH.7-Nov-10 21:14
TorstenH.7-Nov-10 21:14 
Questionvideo handling in java Pin
kinl5-Nov-10 21:55
kinl5-Nov-10 21:55 
AnswerRe: video handling in java Pin
Richard MacCutchan5-Nov-10 23:30
mveRichard MacCutchan5-Nov-10 23:30 
QuestionMessage Removed Pin
5-Nov-10 21:15
kingnking5-Nov-10 21:15 
AnswerRe: help with HMM and GMM Pin
Richard MacCutchan5-Nov-10 23:28
mveRichard MacCutchan5-Nov-10 23:28 
GeneralRe: help with HMM and GMM Pin
kingnking6-Nov-10 2:11
kingnking6-Nov-10 2:11 
QuestionArrayList Class Pin
ammu233-Nov-10 3:43
ammu233-Nov-10 3:43 
AnswerRe: ArrayList Class Pin
TorstenH.3-Nov-10 21:57
TorstenH.3-Nov-10 21:57 
AnswerRe: ArrayList Class Pin
jschell4-Nov-10 8:40
jschell4-Nov-10 8:40 
QuestionHibernate from Eclipse to NetBeans Pin
CostasAn2-Nov-10 23:37
CostasAn2-Nov-10 23:37 
AnswerRe: Hibernate from Eclipse to NetBeans Pin
Nagy Vilmos2-Nov-10 23:48
professionalNagy Vilmos2-Nov-10 23:48 
GeneralRe: Hibernate from Eclipse to NetBeans Pin
CostasAn3-Nov-10 8:26
CostasAn3-Nov-10 8:26 
QuestionAbout repaint() method in java applet Pin
WindowsVsLinux1-Nov-10 9:35
WindowsVsLinux1-Nov-10 9:35 
AnswerRe: About repaint() method in java applet Pin
Richard MacCutchan1-Nov-10 11:42
mveRichard MacCutchan1-Nov-10 11:42 
AnswerRe: About repaint() method in java applet Pin
tux_linux22-Nov-10 4:06
tux_linux22-Nov-10 4:06 
GeneralRe: About repaint() method in java applet Pin
Nagy Vilmos2-Nov-10 4:20
professionalNagy Vilmos2-Nov-10 4:20 
Questionread image pixels Pin
danar_kalari31-Oct-10 4:32
danar_kalari31-Oct-10 4:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.