title: AQuery (Android Query) How to load images actually
body: <p>I am currently using <a href="https://code.google.com/p/android-query/wiki/ImageLoading" rel="nofollow">Android Query</a> library for image loading from server.</p>
  
  <p><strong>MAIN PROB:</strong>
  I want to store images first time and then after i want to load images from cache.
  I have seen here options for <a href="https://code.google.com/p/android-query/wiki/ImageLoading#Cache_Control" rel="nofollow">Cache Control</a> using <strong><em>memCache</em></strong> and <strong><em>fileCache</em></strong> But i didn't get which is better to use for <strong>slow Internet connection</strong> and minimum <strong>Memory usage</strong>.</p>
  
  <p>I have probably following solution with some confusion:</p>
  
  <p>First of all i have used like this:( <em>memCache</em> and <em>fileCache</em> both <code>true</code>)</p>
  
  <pre><code>aq.id(holder.prodImage).image(holder.prodImagePath, true, true, 0, R.drawable.no_image, aq.getCachedImage(R.drawable.no_image), AQuery.FADE_IN);
  </code></pre>
  
  <p>But <a href="https://code.google.com/p/android-query/wiki/ImageLoading#Cache_Control" rel="nofollow">Here</a> he has said that <code>if image is huge, avoid memory caching</code></p>
  
  <p>But i got problem while <strong>network is slow and memory is not sufficient</strong></p>
  
  <p>then after i have tried <a href="https://code.google.com/p/android-query/wiki/ImageLoading#Delay_Image_Loading" rel="nofollow">Delay Image Loading</a>: </p>
  
  <pre><code>if(aq.shouldDelay(position, convertView, parent, holder.prodImagePath)){
      aq.id(holder.prodImage).image(R.drawable.no_image);
  } else {
      aq.id(holder.prodImage).progress(view.findViewById(R.id.progressBar1)).image(holder.prodImagePath, false, true, 0, 0, null, AQuery.FADE_IN);
  }
  </code></pre>
  
  <p>But its throwing <code>NullPointerException</code> like following:</p>
  
  <pre><code>12-10 12:11:26.492: E/AndroidRuntime(23309): java.lang.NullPointerException
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at com.androidquery.util.Common.shouldDelay(Common.java:328)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at com.androidquery.util.Common.shouldDelay(Common.java:340)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at com.androidquery.AbstractAQuery.shouldDelay(AbstractAQuery.java:2389)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at com.salesman.fragments.ProductFragment$MyGridViewAdapter.getView(ProductFragment.java:423)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at android.widget.AbsListView.obtainView(AbsListView.java:2477)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at android.widget.GridView.makeAndAddView(GridView.java:1331)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at android.widget.GridView.makeRow(GridView.java:331)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at android.widget.GridView.fillDown(GridView.java:283)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at android.widget.GridView.fillGap(GridView.java:243)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5549)
  12-10 12:11:26.492: E/AndroidRuntime(23309):    at android.widget.AbsListView$FlingRunnable.run(AbsListView.java:4693)
  </code></pre>
  
  <p>what can i do and how i used this library for this simple problem</p>
  
  <p>Please give me Solution.</p>
  
  <p>Your Help would be Appreciated.</p>