title: How to call a method in MainActivity from another class?
body: <p>How do I call the method <code>startChronometer</code> in another class when the method is declared inside the main activity? </p>
  
  <p>Inside <code>MainActivity</code>: </p>
  
  <pre><code>public void startChronometer() {
      mChronometer.start();
      showElapsedTime();
  }
  </code></pre>
  
  <p>Inside another class, I tried to do this:</p>
  
  <pre><code>MainActivity mActivity;
  mActivity.startChronometer();
  </code></pre>
  
  <p>But an error occurred which said: </p>
  
  <pre><code>java.lang.NullPointerException. 
  </code></pre>
  
  <p>May I know what more I need to add to the code? </p>