Android Open Source - Rejsekort-Reminder Time Sensor

From Project

Back to project page Rejsekort-Reminder.


The source code is released under:

GNU General Public License

If you think the Android project Rejsekort-Reminder listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.example.publictransportation.sensors;
/*from  w  ww  .j a va2s  .  c om*/
import java.util.Timer;
import java.util.TimerTask;

import android.os.Handler;

import com.example.publictransportation.modes.AbstractMode;

 * This is a "fake" sensor... in that it actually isn't a sensor,
 * but rather a simple timer placed into the existing Mode/Sensor logic.
 * In this way, stopwatch operations are implemented the same as any other sensor.
public class TimeSensor extends AbstractSensor {

  Timer timer;
  TimerTask timerTask;
  Handler handler;
  final static String TICK = "TICK";

  public TimeSensor(AbstractMode parentMode, int delayInMilliseconds) {
    handler = new Handler();

    timer = new Timer();
    timerTask = new TimerTask() {

      public void run() { Runnable() {
          public void run(){


    timer.scheduleAtFixedRate(timerTask, delayInMilliseconds, delayInMilliseconds);

  public void kill() {

  public SensorTypes getType() {
    return SensorTypes.TIME;

  public String getLabel() {
    return "timer";


Java Source Code List