title: Passing Countdown Timer beetwen Activities in Android
body: <p>I'm trying to pass the a CountDownTimer value from <code>Activity</code> 1(<code>PrimerNivel)</code> to <code>Activity</code> 2(<code>SegundoNivel</code>)and start the <code>CountDownTimer</code> in <code>Activity</code> 2 from the value that got from the <code>Activity</code> 1.</p>
  
  <p>But the <code>CountDownTimer</code> in <code>Activity</code> 2 is reset to zero. I can't find the error. could someone help me?</p>
  
  <p><strong>This is the code
  Activity 1:</strong></p>
  
  <pre><code>public class PrimerNivel extends InicioActivity {
      private TextView cuentaRegresiva;
      long startTime = 60 * 1000;
      private final long interval = 1 * 1000;
      MyCountDownTimer countDownTimer;
      long tiempoRestante;
  
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.juego);
      cuentaRegresiva=(TextView)findViewById(R.id.cuentaRegresiva);
      countDownTimer = new MyCountDownTimer(startTime, interval);
      cuentaRegresiva.setText(cuentaRegresiva.getText() + String.valueOf(startTime / 1000));
  
  }
  
   public class MyCountDownTimer extends CountDownTimer {
                public MyCountDownTimer(long startTime, long interval) {
                    super(startTime, interval);
  
                }
  
                      @Override
                      public void onFinish() {
                          cuentaRegresiva.setText("");
  
  
                          }
  
                      @Override
                      public void onTick(long millisUntilFinished) {
                          tiempoRestante= millisUntilFinished;
                          cuentaRegresiva.setText(""+millisUntilFinished/1000);
                          }}
  OnClickListener siguiente =new OnClickListener(){
                       public void onClick(View arg0) {
  
                           Intent aNivelSiguiente = new Intent(PrimerNivel.this, SegundoNivel.class);
                           aNivelSiguiente.putExtra("regresivaAnterior", tiempoRestante);
                          startActivity(aNivelSiguiente);
                          PrimerNivel.this.finish();
  
  
  
  
                                                        }};
  
             }
  </code></pre>
  
  <p><strong>Activity 2:</strong></p>
  
  <pre><code>public class SegundoNivel extends InicioActivity {
      private TextView cuentaRegresiva;
      long startTime;
      private final long interval = 1 * 1000;
      MyCountDownTimer countDownTimer;
      Bundle bundle;
  
  
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.juego);
      cuentaRegresiva=(TextView)findViewById(R.id.cuentaRegresiva);
      countDownTimer = new MyCountDownTimer(startTime, interval);
  
  
      bundle = getIntent().getExtras();
      startTime= bundle.getLong("regresivaAnterior")/1000;
      cuentaRegresiva.setText(""+startTime);
      countDownTimer.start(); 
  
  }
  
  public class MyCountDownTimer extends CountDownTimer {
                public MyCountDownTimer(long startTime, long interval) {
              super(startTime, interval);
                }
                      @Override
                      public void onFinish() {
                          cuentaRegresiva.setText("");        
                          }
  
                      @Override
                      public void onTick(long millisUntilFinished) {
                          cuentaRegresiva.setText(""+millisUntilFinished/1000);
                                      }}
  </code></pre>