Package 

Class DetachableClickListener

  • All Implemented Interfaces:
    android.content.DialogInterface.OnClickListener

    
    public final class DetachableClickListener
     implements DialogInterface.OnClickListener
                        

    Wrapper class for DialogInterface.OnClickListener to clear the reference to the listener when the dialog window is detached. This fixes the issue of potential memory leaks on OS prior to Android Lollipop when using dialogs.

    • Method Summary

      Modifier and Type Method Description
      static DetachableClickListener wrap(DialogInterface.OnClickListener delegate)
      void onClick(DialogInterface dialog, int which)
      void clearOnDetach(Dialog dialog) Nulls out listener when dialog is detached from window.Must be set after Dialog.show() is called.
      • Methods inherited from class android.content.DialogInterface.OnClickListener

        onClick
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait