title: Is bitmap can be used after it's been garbage collected?
body: <p>I was watching this video, that talks about memory allocation for bitmaps and garbage collection:</p>
  
  <p><a href="http://www.youtube.com/watch?v=rsQet4nBVi8" rel="nofollow">DevBytes: Bitmap Allocation</a></p>
  
  <p>Chet is talking about how it was managed by the developer prior to <code>SDK 11</code> by using <code>.recycle()</code> and after <code>SDK 11</code> it's is managed by the <code>GC</code>.</p>
  
  <p>To a more practical case currently I'm writing an application that in one of the <code>Activities</code> I create <strong>many fragments</strong> which basically hold a <strong>scroll-able layout of</strong> <code>ImageViews</code>. those Images are created from the device camera. So I encountered the <code>OutOfMemory</code> problem and realized that I had to re-size the Images I got from the camera because the result was really high res and took all my application memory.</p>
  
  <p>So now I'm re-sizing and setting the images with very small sizes using this method:</p>
  
  <p><code>img.setImageBitmap(decodeSampledBitmapFromFile(imagePath, 100, 70));</code></p>
  
  <p>when <code>decodeSampledBitmapFromFile</code> is:</p>
  
  <pre><code>    public static Bitmap decodeSampledBitmapFromFile(String path, int reqWidth, int reqHeight) 
  { // BEST QUALITY MATCH
  
      // First decode with inJustDecodeBounds=true to check dimensions
      final BitmapFactory.Options options = new BitmapFactory.Options();
      options.inJustDecodeBounds = true;
      BitmapFactory.decodeFile(path, options);
  
      // Calculate inSampleSize
          // Raw height and width of image
          final int height = options.outHeight;
          final int width = options.outWidth;
          options.inPreferredConfig = Bitmap.Config.RGB_565;
          int inSampleSize = 1;
  
          if (height &gt; reqHeight) {
              inSampleSize = Math.round((float)height / (float)reqHeight);
          }
  
          int expectedWidth = width / inSampleSize;
  
          if (expectedWidth &gt; reqWidth) {
              //if(Math.round((float)width / (float)reqWidth) &gt; inSampleSize) // If bigger SampSize..
              inSampleSize = Math.round((float)width / (float)reqWidth);
          }
      options.inSampleSize = inSampleSize;
  
      // Decode bitmap with inSampleSize set
      options.inJustDecodeBounds = false;
  
      return BitmapFactory.decodeFile(path, options);
    }
  </code></pre>
  
  <p>}</p>
  
  <p>but still I never call <code>.recycle()</code> method on any of the bitmaps because I need them all to be present on screen. </p>
  
  <p><strong>My Questions Are:</strong></p>
  
  <p><strong>1.</strong> if I call  <code>.recycle()</code> on a bitmap that was already set to an <code>ImageView</code> using <code>setImageBitmap</code> does it mean that it will disappear from the screen or maybe I will receive an exception?</p>
  
  <p><strong>2.</strong> If I don't call <code>.recycle()</code> but I'm running my application on Galaxy S3<code>(4.2.1)</code> for example while my application is <code>minSDK is 8</code>. Will the GC kick to do the job for me? </p>
  
  <p><strong>3.</strong> In the video he is talking about bitmap reuse using the <code>BitmapFactory</code> object, is there a way to do that prior to SDK 11? </p>