title: cannot resolve getBaseContext() in android
body: <p>Hello I am new to android and ran into a strange error. I had this error handling script that I would need to be using through out the project. The code is currently working fine from the signup.java file. The code looks like this</p>
  
  <pre><code> public void error(boolean flag, String etext, String page)
      {
          if(flag==true)
          {
              Toast.makeText(getBaseContext(), etext, Toast.LENGTH_SHORT).show();
  
          }
      else
      {
          Toast.makeText(getBaseContext(), etext, Toast.LENGTH_SHORT).show();
          //Redirect to somepage
      }
  }
  </code></pre>
  
  <p>I thought since I will be making frequent use of this block I should put it inside a seperate java class and then call it in all other classes I need this functionality so I created a <code>error.java</code> file and when I copy pasted this code and imported the <code>android.widget.Toast</code> I still get the error that </p>
  
  <blockquote>
    <p>Cannot resolve method getBaseContext()</p>
  </blockquote>
  
  <p>Why this error, when the same code works fine in the other .java class?</p>