How can I start a chronometer in a service?
I ask this because you can't associate an XML file to a service
Chronometer mChronometer = (Chronometer) findViewById(R.id.chronometer);
My goal is to vibrate phone after the prox sensor has been keep covered for at least 5 seconds.
In onNear i would like to start a chronometer and do something if the object is still near the sensor when chronometer reaches 5 seconds.
Chronometer
is a widget. It is part of the user interface. Services do not have a user interface. Services do not use widgets. Services do not use Chronometer
.
Use Timer
and TimerTask
to get control after five seconds within a service.