title: How can I get the context of the activity which is calling a static function?
body: <p>I have a network class making use of the following lib: <a href="http://loopj.com/android-async-http/doc/com/loopj/android/http/AsyncHttpClient.html" rel="nofollow">Lib Docs</a> with 4 function to make a get, post delete and put request to the server. here is the simplified version:</p>
  
  <pre><code> public static void get(Context context, String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {          
      httpClient.get(context, getAbsoluteUrl(url), params, responseHandler);
  } 
  </code></pre>
  
  <p>Now instead of having to pass the context through via a paramter, Is there no possible way to some how get the context of the calling activity inside the fucntion?</p>
  
  <p>some thing along the lines of:</p>
  
  <pre><code>public static void get(String url, RequestParams params, AsyncHttpResponseHandler responseHandler) {
      Context context = getCallignActivtyCntext() // &lt;====== some thing like this
      httpClient.get(context, getAbsoluteUrl(url), params, responseHandler);
  }
  </code></pre>
  
  <p>the reason I need the specific context is because I have to cancel all network requests when an activity is destroyed, and it groups or identifies all requests by the context.</p>