title: how do i pass the stopwatch value over to another activity
body: <p>im trying to make a stopwatch for this quiz im making, but i dont know how to pass the stopwatch from question to question(1 question per activity). code for the stopwatch is as follows.</p>
  
  <pre><code>@Override  
  protected void onCreate(Bundle savedInstanceState) {  
      super.onCreate(savedInstanceState);  
      setContentView(R.layout.activity_main);  
  
      timer = (TextView)findViewById(R.id.tvTimer);  
      start = (Button)findViewById(R.id.btStart);  
      pause = (Button)findViewById(R.id.btPause);  
      reset = (Button)findViewById(R.id.btReset);  
  
      handler = new Handler() ;  
  
      start.setOnClickListener(new View.OnClickListener() {  
          @Override  
          public void onClick(View view) {  
  
              StartTime = SystemClock.uptimeMillis();  
              handler.postDelayed(runnable, 0);  
  
              reset.setEnabled(false);  
  
          }  
      });  
  
      pause.setOnClickListener(new View.OnClickListener() {  
          @Override  
          public void onClick(View view) {  
  
              TimeBuff += MillisecondTime;  
  
              handler.removeCallbacks(runnable);  
  
              reset.setEnabled(true);  
  
          }  
      });  
  
      reset.setOnClickListener(new View.OnClickListener() {  
          @Override  
          public void onClick(View view) {  
  
              MillisecondTime = 0L ;  
              StartTime = 0L ;  
              TimeBuff = 0L ;  
              UpdateTime = 0L ;  
              Seconds = 0 ;  
              Minutes = 0 ;  
              MilliSeconds = 0 ;  
  
              timer.setText("00:00:00");  
  
          }  
      });  
  
  }  
  
  public Runnable runnable = new Runnable() {  
  
      public void run() {  
  
          MillisecondTime = SystemClock.uptimeMillis() - StartTime;  
  
          UpdateTime = TimeBuff + MillisecondTime;  
  
          Seconds = (int) (UpdateTime / 1000);  
  
          Minutes = Seconds / 60;  
  
          Seconds = Seconds % 60;  
  
          MilliSeconds = (int) (UpdateTime % 1000);  
  
          timer.setText("" + Minutes + ":"  
                  + String.format("%02d", Seconds) + ":"  
                  + String.format("%03d", MilliSeconds));  
  
          handler.postDelayed(this, 0);  
      }  
  
  };  
  </code></pre>
  
  <p>have been trying for a while now but the app keeps crashing when i press the start button which leads to the first question</p>
  
  <p>i have this at the start of every activity, to start the stopwatch again when a new question comes, i think this is where it crashed?</p>
  
  <pre><code>Handler timerHandler = new Handler();
  Runnable timerRunnable = new Runnable() {
  
      @Override
      public void run() {
          long millis = System.currentTimeMillis() - startTime;
          int seconds = (int) (millis / 1000);
          int minutes = seconds / 60;
          seconds = seconds % 60;
  
          time = String.valueOf(millis);
          timerHandler.postDelayed(this, 500);
      }
  };
  </code></pre>
  
  <p>and run the stopwatch again in onCreate()</p>
  
  <p>line that log shows the crash:</p>
  
  <pre><code>long startTime = Long.parseLong(getIntent().getStringExtra("time"));
  </code></pre>
  
  <p>log:</p>
  
  <pre><code>Process: com.example.ng_we.capsize, PID: 12385
  java.lang.RuntimeException: Unable to instantiate activity ComponentInfo{com.example.ng_we.capsize/com.example.ng_we.capsize.question3}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2839)
      at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3030)
      at android.app.ActivityThread.-wrap11(Unknown Source:0)
      at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1696)
      at android.os.Handler.dispatchMessage(Handler.java:105)
      at android.os.Looper.loop(Looper.java:164)
      at android.app.ActivityThread.main(ActivityThread.java:6938)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:327)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1374)
   Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getStringExtra(java.lang.String)' on a null object reference
      at com.example.ng_we.capsize.question3.&lt;init&gt;(question3.java:19)
      at java.lang.Class.newInstance(Native Method)
      at android.app.Instrumentation.newActivity(Instrumentation.java:1180)
      at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2829)
  </code></pre>