title: Lazy loading GridView with images downloading from internet
body: <p>I've been visiting Stack Overflow for many years and it is the first time that I can't find any post that can solve my problem (at least I didn't see any).</p>
  
  <p>I have a <code>GridView</code> with a custom adapter, which I have overridden to return a custom view made by an <code>ImageView</code> and a <code>TextView</code>.</p>
  
  <p>I load the images after JSON parsing them from URLs with an <code>AsyncTask</code>, storing all the info into an <code>ArrayList</code> in the <code>doInBackground()</code> method and calling <code>notifyDataSetChanged()</code> in the <code>onPostExecute()</code> method. Everything's fine.</p>
  
  <p>Now my problem is that when I launch the activity it takes a time of 5-10 seconds before the grid view will create and present itself to the user in entity. I'm wondering if there is a way to show the grid view with the text info first and then each image will load. Is this possible or not because they are both created in the same method?</p>
  
  <pre><code>@Override
  public View getView(int arg0, View arg1, ViewGroup arg2) {
      View v = null;
      if (arg1 == null) {
          LayoutInflater inflater = (LayoutInflater) mContext.getSystemService(
                  Context.LAYOUT_INFLATER_SERVICE);
          v = inflater.inflate(R.layout.custom_product_view, null);
      } else {
          v = arg1;
      }
  
      iv = (ImageView) v.findViewById(R.id.product_image);
      imageLoader.DisplayImage(products.get(arg0).getImage(), iv);
  
      TextView tv = (TextView) v.findViewById(R.id.product_price);
      tv.setText(products.get(arg0).getPrice());
  
      return v;
  }
  </code></pre>
  
  <p>I also must inform you as you can see from the <code>DisplayImage()</code> method that I have implemented this lazy loading: <a href="https://stackoverflow.com/questions/541966/how-do-i-do-a-lazy-load-of-images-in-listview/3068012#3068012">Lazy load of images in ListView</a>. It works fine but the thing is that it loads the whole view again. What I want to do is launch the activity, load caption first and then the image will load when it finishes downloading. With this code here, it just lazy loads the whole View that every cell of the grid view contains. I earned some seconds because I don't download all the images at once like before but still it's not what I'm searching for.</p>
  
  <p>Thanks a lot.</p>