@Override protected void onDestroy() { super.onDestroy(); // mRajRenderer.onSurfaceDestroyed(); unbindDrawables(mLayout); System.gc(); }
private void unbindDrawables(View view) { if (view.getBackground() != null) { view.getBackground().setCallback(null); } if (view instanceof ViewGroup && !(view instanceof AdapterView)) { for (int i = 0; i < ((ViewGroup) view).getChildCount(); i++) { unbindDrawables(((ViewGroup) view).getChildAt(i)); } ((ViewGroup) view).removeAllViews(); } }