title: getApplicationContext()' on a null object reference using volley in non-activity
body: <p>Take time trying to call a json from android, but the problem is the confusion of context, this is the error returned me</p>
  
  <pre><code>    02-09 19:48:05.494 16350-16350/com.example.cesar.mybankaccess E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.example.cesar.mybankaccess, PID: 16350
  java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
  at restful.dao.PatronSingleton.getRequestQueue(PatronSingleton.java:37)
  at restful.dao.PatronSingleton.&lt;init&gt;(PatronSingleton.java:25)
  at restful.dao.PatronSingleton.getInstance(PatronSingleton.java:30)
  at restful.dao.Cliente.dologin(Cliente.java:84)
  at restful.RestfulOperacional.dologin(RestfulOperacional.java:22)
  at com.example.cesar.mybankaccess.view.Login.dologin(Login.java:118)
  at com.example.cesar.mybankaccess.view.Login.access$100(Login.java:30)
  at com.example.cesar.mybankaccess.view.Login$2.onClick(Login.java:67)
  at android.view.View.performClick(View.java:5198)
  at android.view.View$PerformClick.run(View.java:21147)
  at android.os.Handler.handleCallback(Handler.java:739)
  at android.os.Handler.dispatchMessage(Handler.java:95)
  at android.os.Looper.loop(Looper.java:148)
  at android.app.ActivityThread.main(ActivityThread.java:5417)
  at java.lang.reflect.Method.invoke(Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
  </code></pre>
  
  <p>I do not get fix, i'm sure is for context getContext or similar, but can't build one</p>
  
  <pre><code>public class RestfulOperacional {
      Cliente cliente;
  
      public RestfulOperacional() {
          cliente = new Cliente();
      }
  
      public Object dologin(String s, String s1) {
          return cliente.dologin(s, s1);
      }
  }
  </code></pre>
  
  <p>And Class on try parse JSON</p>
  
  <pre><code>public class Cliente extends Application {
      private String URL_JSON;
      private static Context context;
      private static Cliente instance = null;
  
      public Cliente(Context context) {
          this.context = context;
      }
  
      public Cliente() {
  
      }
  
  
      @Override
      public void onCreate() {
          super.onCreate();
          context = getContext();
      }
  
      public static Context getContext() {
          return context;
      }
      public static Cliente getInstance(Context context) {
          if (instance == null) {
              instance = new Cliente(context);
          }
          return instance;
      }
      public Cliente dologin(String s, String s1) {
          URL_JSON = Constantes.URL_JSON + Constantes.URL_API_CLIENTE + Constantes.URL_API_CLIENTE_LOGIN;
          // Mapeo de los pares clave-valor
          HashMap&lt;String, String&gt; parametros = new HashMap();
          parametros.put("nif", s);
          parametros.put("claveSeguridad", s1);
          JsonObjectRequest jsArrayRequest = new JsonObjectRequest(
                  Request.Method.POST,
                  URL_JSON,
                  new JSONObject(parametros),
                  new Response.Listener&lt;JSONObject&gt;() {
                      @Override
                      public void onResponse(JSONObject response) {
                          Log.i("Json", response.toString());
                          // Manejo de la respuesta
                          //notifyDataSetChanged();
                      }
                  },
                  new Response.ErrorListener() {
  
                      @Override
                      public void onErrorResponse(VolleyError error) {
                      }
                  });
          PatronSingleton.getInstance(getContext()).addToRequestQueue(jsArrayRequest);
          return null;
      }
  }
  </code></pre>