I have a GPSLoc class with the following method
public  class GPSLoc   { 
    public static void HAHA ()
      {
          {Toast.makeText( context,"SD Card not available , savin to local phone", Toast.LENGTH_LONG).show();};
      }
      private static  Context context;
then I am creating a button in the main activity with the simple task of calling that method and display the toast
Button three=(Button)findViewById(R.id.three);
three.setOnClickListener(new Button.OnClickListener() {
    public void onClick(View v) {
        GPSLoc Test1=new GPSLoc();  
        Test1.HAHA();
    }
and then I got that in the LogCat
 07-13 20:41:39.492: E/AndroidRuntime(6778): FATAL EXCEPTION: main
  07-13 20:41:39.492: E/AndroidRuntime(6778): java.lang.NullPointerException
  07-13 20:41:39.492: E/AndroidRuntime(6778):   at android.widget.Toast.<init>(Toast.java:90)
  07-13 20:41:39.492: E/AndroidRuntime(6778):   at android.widget.Toast.makeText(Toast.java:232)
  07-13 20:41:39.492: E/AndroidRuntime(6778):   at com.example.testnewbutton.GPSLoc.HAHA(GPSLoc.java:100)
  07-13 20:41:39.492: E/AndroidRuntime(6778):   at com.example.testnewbutton.MainActivity$1.onClick(MainActivity.java:67)
 
     
     
    