@Override protected void onDestroy() { super.onDestroy(); // release any resources here }
@Override protected void onDestroy() { unregisterReceiver(mBroadcastReceiver); super.onDestroy(); }
@Override protected void onDestroy() { if (mAlertDialog != null) { mAlertDialog.dismiss(); mAlertDialog = null; } super.onDestroy(); }In this example, the onDestroy() method is dismissing and releasing a AlertDialog that was shown in a previous method. This is done to prevent any memory leaks from occurring. Package/library: android.app (for AlertDialog)