diff --git a/library/src/main/java/com/vorlonsoft/android/rate/DialogOptions.java b/library/src/main/java/com/vorlonsoft/android/rate/DialogOptions.java index 1de8447..4ddca80 100644 --- a/library/src/main/java/com/vorlonsoft/android/rate/DialogOptions.java +++ b/library/src/main/java/com/vorlonsoft/android/rate/DialogOptions.java @@ -9,7 +9,7 @@ import android.content.Context; import android.view.View; -import java.lang.ref.WeakReference; +import java.lang.ref.SoftReference; import androidx.annotation.Nullable; @@ -56,7 +56,7 @@ public final class DialogOptions { private View view = null; - private OnClickButtonListener listener = null; + private SoftReference listener = null; DialogOptions() { } @@ -148,11 +148,11 @@ void setView(View view) { @Nullable OnClickButtonListener getListener() { - return listener; + return listener != null ? listener.get() : null; } void setListener(OnClickButtonListener listener) { - this.listener = listener; + this.listener = new SoftReference<>(listener); } public String getTitleText(Context context) {