title: App crash with custom progress dialog
body: <p>I am facing error while displaying custom progress dialog. I have created progress dialog with 40 different images. It woks fine. but if i try to show dialog more than 8-10 times app crash.</p>
  
  <p>Error log</p>
  
  <pre><code>09-20 13:11:12.620: E/AndroidRuntime(9156): FATAL EXCEPTION: main
  09-20 13:11:12.620: E/AndroidRuntime(9156): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.spec.vespa/com.spec.vespa.view.SettingsActivity}: android.view.InflateException: Binary XML file line #13: Error inflating class &lt;unknown&gt;
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1659)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1675)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.ActivityThread.access$1500(ActivityThread.java:121)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:943)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.os.Handler.dispatchMessage(Handler.java:99)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.os.Looper.loop(Looper.java:138)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.ActivityThread.main(ActivityThread.java:3701)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at java.lang.reflect.Method.invokeNative(Native Method)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at java.lang.reflect.Method.invoke(Method.java:507)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:878)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:636)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at dalvik.system.NativeStart.main(Native Method)
  09-20 13:11:12.620: E/AndroidRuntime(9156): Caused by: android.view.InflateException: Binary XML file line #13: Error inflating class &lt;unknown&gt;
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.createView(LayoutInflater.java:518)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at com.android.internal.policy.impl.PhoneLayoutInflater.onCreateView(PhoneLayoutInflater.java:56)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:568)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:623)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.rInflate(LayoutInflater.java:626)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.inflate(LayoutInflater.java:408)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.inflate(LayoutInflater.java:320)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.inflate(LayoutInflater.java:276)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:207)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.Dialog.setContentView(Dialog.java:421)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at com.spec.vespa.view.SettingsActivity.onCreate(SettingsActivity.java:124)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1623)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     ... 11 more
  09-20 13:11:12.620: E/AndroidRuntime(9156): Caused by: java.lang.reflect.InvocationTargetException
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at java.lang.reflect.Constructor.constructNative(Native Method)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at java.lang.reflect.Constructor.newInstance(Constructor.java:415)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.view.LayoutInflater.createView(LayoutInflater.java:505)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     ... 23 more
  09-20 13:11:12.620: E/AndroidRuntime(9156): Caused by: java.lang.OutOfMemoryError: bitmap size exceeds VM budget
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.Bitmap.nativeCreate(Native Method)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.Bitmap.createBitmap(Bitmap.java:477)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.Bitmap.createBitmap(Bitmap.java:444)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.Bitmap.createScaledBitmap(Bitmap.java:349)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.BitmapFactory.finishDecode(BitmapFactory.java:521)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:496)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:359)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.drawable.Drawable.createFromResourceStream(Drawable.java:715)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.content.res.Resources.loadDrawable(Resources.java:1721)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.content.res.Resources.getDrawable(Resources.java:585)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.drawable.AnimationDrawable.inflate(AnimationDrawable.java:267)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:805)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.graphics.drawable.Drawable.createFromXml(Drawable.java:746)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.content.res.Resources.loadDrawable(Resources.java:1706)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.content.res.TypedArray.getDrawable(TypedArray.java:601)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.widget.ProgressBar.&lt;init&gt;(ProgressBar.java:215)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     at android.widget.ProgressBar.&lt;init&gt;(ProgressBar.java:170)
  09-20 13:11:12.620: E/AndroidRuntime(9156):     ... 26 more
  </code></pre>
  
  <p>I have also do some memory management as stated below:</p>
  
  <pre><code>public void unbindDrawables(View view) {
          if (view.getBackground() != null) {
              view.getBackground().setCallback(null);
          }
          if (view instanceof ViewGroup) {
              for (int i = 0; i &lt; ((ViewGroup) view).getChildCount(); i++) {
                  unbindDrawables(((ViewGroup) view).getChildAt(i));
              }
              try{
                  ((ViewGroup) view).removeAllViews();
              }catch (UnsupportedOperationException e) {}
          }
      }
  </code></pre>
  
  <p>What I am missing ?</p>
  
  <p>Progress bar xml:</p>
  
  <p>
  </p>
  
  <pre><code>&lt;RelativeLayout android:layout_width="fill_parent"
  android:layout_marginLeft="40dp"
  android:layout_height="wrap_content"
  android:layout_centerInParent="true"
  android:background="@drawable/progress_context"&gt;
  &lt;ProgressBar android:layout_height="100dp"
             android:layout_width="100dp"
             android:id="@+id/prg"
             android:layout_centerHorizontal="true"
             android:layout_marginTop="10dp"
             android:drawingCacheQuality="low"
             style="@android:style/Widget.ProgressBar.Large.Inverse"
             android:indeterminateDrawable="@drawable/custom_progress_drawable"/&gt;
  
  &lt;TextView android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_below="@+id/prg"
      android:layout_marginTop="15dp"
      android:textSize="20sp"
      android:textColor="#ffffff"
      android:text="@string/loading"
      android:paddingBottom="10dp"
      android:id="@+id/txtProgressMessage"
      android:layout_centerHorizontal="true"/&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p></p>