title: Call to a CountDownTimer method pushes a Null pointer exception
body: <p>I am working on a count down timer which seems to be spitting out  a null pointer exception when the method gets called. Please see below for the logcat output:</p>
  
  <pre><code>    01-02 21:26:50.772: D/AndroidRuntime(1743): Shutting down VM
      01-02 21:26:50.772: W/dalvikvm(1743): threadid=1: thread exiting with uncaught exception (group=0xb4a72ba8)
      01-02 21:26:50.842: E/AndroidRuntime(1743): FATAL EXCEPTION: main
      01-02 21:26:50.842: E/AndroidRuntime(1743): Process: com.vertygoeclypse.multitimer, PID: 1743
      01-02 21:26:50.842: E/AndroidRuntime(1743): java.lang.NullPointerException
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at com.vertygoeclypse.multitimer.MainActivity.onClick(MainActivity.java:93)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at android.view.View.performClick(View.java:4438)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at android.view.View$PerformClick.run(View.java:18422)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at android.os.Handler.handleCallback(Handler.java:733)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at android.os.Handler.dispatchMessage(Handler.java:95)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at android.os.Looper.loop(Looper.java:136)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at android.app.ActivityThread.main(ActivityThread.java:5017)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at java.lang.reflect.Method.invokeNative(Native Method)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at java.lang.reflect.Method.invoke(Method.java:515)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
      01-02 21:26:50.842: E/AndroidRuntime(1743):     at dalvik.system.NativeStart.main(Native Method)
      01-02 21:26:53.162: I/Process(1743): Sending signal. PID: 1743 SIG: 9
  </code></pre>
  
  <p>The logcat shows me that the null pointer exception comes from line 93 of my code and this line is below:</p>
  
  <pre><code>    countDownTimer.start();
  </code></pre>
  
  <p>That links to the below initializing statement:</p>
  
  <pre><code>    MultiCountDownTimer countDownTimer;
  </code></pre>
  
  <p>that leads us Now to this code that is pointing to a CountDownTimer with the onfinish() and onTick() overridden by my own lines, see below for the code in question:</p>
  
  <pre><code>        public class MultiCountDownTimer extends CountDownTimer
  {
      public MultiCountDownTimer(long startTime, long interval)
          {
              super(startTime, interval);
          }
      @Override
      public void onFinish()
          {
              timeRemaining.setText("Time's up!");
              timeElapsedView.setText("Time Elapsed: " + String.valueOf(startTime));
          }
      @Override
      public void onTick(long millisUntilFinished)
          {
              timeRemaining.setText("Time remain:" + millisUntilFinished);
              timeElapsed = startTime - millisUntilFinished;
              timeElapsedView.setText("Time Elapsed: " + String.valueOf(timeElapsed));
          }
  }
  </code></pre>
  
  <p>I have the two requirements being set from values set in a dialogbox with numberpickers. I log.i the 2 place holder variables and they return the long values as required. See below for the code that sets the required values:</p>
  
  <pre><code>        long startTime=0;
  long interval=1000;
  long coversionvalues=0;
  </code></pre>
  
  <p>Those are the initializers.</p>
  
  <pre><code>            case R.id.submitbtn:
          tgview.setText(String.valueOf(tagvalue.getText()));
          minview.setText(String.valueOf(minnp.getValue()));
          secview.setText(String.valueOf(secnp.getValue()));
          int val1 = Integer.parseInt(String.valueOf(minnp.getValue()));
          int val2 = Integer.parseInt(String.valueOf(secnp.getValue()));
          int val3 = (val1*60)*1000;
          int val4 = val2*1000;
          coversionvalues = Long.valueOf(String.valueOf(val3+val4));
          startTime = coversionvalues;
          starest.setEnabled(true);
          cusd.dismiss(); 
          break;
  </code></pre>
  
  <p>That is the case within a switch that works with the onclick to get the values set them to some place holders on the screen, as well as convert the numberpicker values to long for the CountDownTimer. after that the nutton to start the count down is enabled and the dialog box is dismissed. then the case is broken. This works fine it is the portion with the starting the timer that lead me to this point.</p>
  
  <p>Any assistance that you all can render would be greatly appreciated.</p>
  
  <p>regards</p>
  
  <p>cchinchoy</p>