here is my java code
@Override protected void onDestroy() { int i; super.onDestroy(); if (bitmapList != null) { for (i = INDEX_COLLAGE; i < bitmapList.length; i += INDEX_COLLAGE_BACKGROUND) { if (bitmapList[i] != null) { bitmapList[i].recycle(); } } } if (collageView != null) { if (collageView.shapeLayoutList != null) { for (i = INDEX_COLLAGE; i < collageView.shapeLayoutList.size(); i += INDEX_COLLAGE_BACKGROUND) { for (int j = INDEX_COLLAGE; j < collageView.shapeLayoutList.get(i).shapeArr.length; j += INDEX_COLLAGE_BACKGROUND) { if (collageView.shapeLayoutList.get(i).shapeArr[j] != null) { collageView.shapeLayoutList.get(i).shapeArr[j].freeBitmaps(); } } } } if (collageView.maskBitmapArray != null) { for (i = INDEX_COLLAGE; i < collageView.maskBitmapArray.length; i += INDEX_COLLAGE_BACKGROUND) { if (collageView.maskBitmapArray[i] != null) { if (!collageView.maskBitmapArray[i].isRecycled()) { collageView.maskBitmapArray[i].recycle(); } collageView.maskBitmapArray[i] = null; } } } } if (adWhirlLayout != null) { adWhirlLayout.removeAllViews(); adWhirlLayout.destroy(); }}private void backButtonAlertBuilder() { AlertDialog.Builder builder = new AlertDialog.Builder(CreateCollageActivity.this); builder.setMessage("Would you like to save image ?").setCancelable(true).setPositiveButton("Yes", new OnClickListener() { public void onClick(DialogInterface dialog, int id) { if (analytics != null) analytics.logEvent(Analytics.Param.IMAGE_SAVE, ""); new SaveImageTask().execute(); }}).setNeutralButton("No", new OnClickListener() { public void onClick(DialogInterface dialog, int which) { finish(); } });
The app crashes when i click back button..when i debugged the code it showed java.lang.RuntimeException: Unable to destroy activity and HVDactivities.CreateCollageActivity.onDestroy(CreateCollageActivity.java:740)