title: NPE using AQuery for JSON AsynchTask
body: <p>I'm using <a href="http://code.google.com/p/android-query/" rel="nofollow">Android-Query</a> for the first time and I understand that it (takes care of the asynchronous tasks for you?) and simplifies/reduces code writing. Correct me if I'm wrong about the asynchronous tasks. </p>
  
  <p>Also, if I am wrong, please help me write the method below so it is on another thread; I cant get it to work either way I do it.</p>
  
  <p>I'm getting the following NPE:</p>
  
  <pre><code>java.lang.RuntimeException: Unable to start activity ComponentInfo{com.andaero.app/com.andaero.app.MainActivity}: java.lang.NullPointerException
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
  at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
  at android.app.ActivityThread.access$600(ActivityThread.java:123)
  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
  at android.os.Handler.dispatchMessage(Handler.java:99)
  at android.os.Looper.loop(Looper.java:137)
  at android.app.ActivityThread.main(ActivityThread.java:4424)
  at java.lang.reflect.Method.invokeNative(Native Method)
  at java.lang.reflect.Method.invoke(Method.java:511)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:787)
  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:554)at dalvik.system.NativeStart.main(Native Method)
  ---&gt;Caused by: java.lang.NullPointerException
  at com.andaero.app.utili.AsyncJSON.async_list_array(AsyncJSON.java:24)
  at com.andaero.app.MainActivity.onCreate(MainActivity.java:84)
  at android.app.Activity.performCreate(Activity.java:4465)
  at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
  at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
  </code></pre>
  
  <p>Within my MainActivity:</p>
  
  <pre><code>import com.androidquery.AQuery;
  import com.androidquery.callback.AjaxCallback;
  import com.androidquery.callback.AjaxStatus;
   ...
   AQuery aq;
   String json = null;
  
  public class MainActivity extends Activity implements AnimationLayout.Listener
  {
   @Override
   public void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
          ...
          AsyncJSON.async_list_array();
      }
  }
  </code></pre>
  
  <p>My AsyncJSON class:</p>
  
  <pre><code> public class AsyncJSON
   {
      static AQuery aq = null;
      static JSONArray jArray;
      String json = null;
  
  public static void async_list_array()
  {
  
  String url = "http://192.168.1.34/Andaero/php/regulatory_list.php";
  aq.ajax(url, JSONArray.class, new AjaxCallback&lt;JSONArray&gt;()
  {
  
      @Override
      public void callback(String url, JSONArray json, AjaxStatus status)
      {
  
      if (json != null)
      {
  
      // successful ajax call, show status code, json content
      //jsonListCallback(json);
      Toast.makeText(aq.getContext(), status.getCode() + ":" + json.toString(), Toast.LENGTH_LONG).show();
  
      } else
      {
  
      // ajax error, show error code
      Toast.makeText(aq.getContext(), "Error:" + status.getCode(), Toast.LENGTH_LONG).show();
      }
      }
  });
  }
  </code></pre>
  
  <p>I took this code directly from their example but I cant see what I have wrong.</p>
  
  <p>Thnx for your help.</p>