Pessoal, porque o cronometro nao para quando damos o comando stop? quando volta no start ele esta como se somente a visualização congelasse e nao que tenha parado mesmo.
Button botaoStart = (Button) findViewById(R.id.botao_start);
Button botaoStop = (Button) findViewById(R.id.botao_stop);
final Chronometer crono = (Chronometer) findViewById(R.id.cronometro);
botaoStart.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
crono.start();
}
});
botaoStop.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
crono.stop();
}
});
xml
<Button
android:id="@+id/botao_start"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/start" >
</Button>
<Button
android:id="@+id/botao_stop"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="@string/stop" >
</Button>
<Chronometer
android:id="@+id/cronometro"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Chronometer" />