title: Android: Unable to destroy activity
body: <p>I am using the following code to removes childs on every viewgroup:</p>
  
  <pre><code>protected void onDestroy() {
      super.onDestroy();
      this.liberarMemoria();
  }
  
  public void liberarMemoria(){
       imagenes.recycleBitmaps(); 
       this.unbindDrawables(findViewById(R.id.RelativeLayout1));
       System.gc();
  }
  private 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));
      }
      ((ViewGroup) view).removeAllViews();
      }
  }
  </code></pre>
  
  <p>where the view: R.id.RelativeLayout1 is a ListView.</p>
  
  <p>But doing this I have en exception:</p>
  
  <pre><code>E/AndroidRuntime(582): java.lang.RuntimeException: Unable to destroy activity {...}: java.lang.UnsupportedOperationException: removeAllViews() is not supported in AdapterView
  </code></pre>
  
  <p>How can I solve this?</p>