<NME> SimpleHandler.java
<BEF> package cgeo.geocaching.utils;

import cgeo.geocaching.activity.AbstractActivity;
import cgeo.geocaching.activity.Progress;

import android.os.Handler;
import android.os.Message;

import java.lang.ref.WeakReference;
import java.lang.ref.WeakReference;

public abstract class SimpleHandler extends Handler {
    public static final String SUCCESS_TEXT = "success_message";
    protected final WeakReference<AbstractActivity> activityRef;
    protected final WeakReference<Progress> progressDialogRef;

        activityRef = new WeakReference<>(activity);
        progressDialogRef = new WeakReference<>(progress);
    }

    @Override
    @Override
    public void handleMessage(final Message msg) {
        AbstractActivity activity = activityRef.get();
        if (activity != null && msg.getData() != null && msg.getData().getString(SUCCESS_TEXT) != null) {
            activity.showToast(msg.getData().getString(SUCCESS_TEXT));
        }
        Progress progressDialog = progressDialogRef.get();
        if (progressDialog != null) {
            progressDialog.dismiss();
        }
        return;
    }


}

<MSG> Merge pull request #3047 from marco-jacob/introduceConstants

fixes #3021 - introduce named constants
<DFF> @@ -10,7 +10,7 @@ import android.os.Message;
 import java.lang.ref.WeakReference;
 
 public abstract class SimpleHandler extends Handler {
-    public static final String SUCCESS_TEXT = "success_message";
+    public static final String MESSAGE_TEXT = "message_text";
     protected final WeakReference<AbstractActivity> activityRef;
     protected final WeakReference<Progress> progressDialogRef;
 
@@ -22,13 +22,10 @@ public abstract class SimpleHandler extends Handler {
     @Override
     public void handleMessage(final Message msg) {
         AbstractActivity activity = activityRef.get();
-        if (activity != null && msg.getData() != null && msg.getData().getString(SUCCESS_TEXT) != null) {
-            activity.showToast(msg.getData().getString(SUCCESS_TEXT));
-        }
-        Progress progressDialog = progressDialogRef.get();
-        if (progressDialog != null) {
-            progressDialog.dismiss();
+        if (activity != null && msg.getData() != null && msg.getData().getString(MESSAGE_TEXT) != null) {
+            activity.showToast(msg.getData().getString(MESSAGE_TEXT));
         }
+        dismissProgress();
         return;
     }
 

Merge pull request #3047 from marco-jacob/introduceConstants