Out of memory on long ListActivity
<p>I have a problem with a ListActivity, it loads a search result, 5 items at a time, and when it reach about 45 items, it throws an out of memory exception.</p>

<p>I load images from web server asyncronically. If I comment this, i can scroll to the bottom of the list (aprox 58 items) without problem. I Know i should call bitmap.Recycle() to gc the bitmaps i no longer use, but I dont find when i should call that.</p>

<pre><code>class ImageLoadingTask extends AsyncTask&lt;String, Void, Bitmap&gt; {
        private final WeakReference&lt;ImageView&gt;  imageViewReference;
        String                                  url;

        public ImageLoadingTask(ImageView imageView) {
            imageViewReference = new WeakReference&lt;ImageView&gt;(imageView);
            imageViewReference.get().setImageDrawable(null);
        }

        @Override
        protected void onPostExecute(Bitmap result) {
            if (isCancelled()) {
                result = null;
            }
            if (imageViewReference != null) {
                ImageView imageView = imageViewReference.get();
                if (imageView != null) {                        
                    imageView.setImageBitmap(result);
                    //result.recycle();
                }
            }
        }

        @Override
        protected void onPreExecute() {
            if (imageViewReference != null) {
                ImageView imageView = imageViewReference.get();
                if (imageView != null) {
                    imageView.setImageResource(R.drawable.icon);
                }
            }
        }

        @Override
        protected Bitmap doInBackground(String... params) {
            url = params[0];
            return Application.get(getContext()).loadBitmap(url);
        }
    }
</code></pre>

<p>As you see in the onPostExecute method. if I call recycle right after the image is asigned to the imageview, it thros an exeption of tying to use a recycled image.</p>

<p>Anybody could help?</p>

<p>Thanks in advance, and sorry for my english :P</p>
