protected void saveWaypointInBackground(final ActivityData currentState, final Handler finishHandler) {
        final Waypoint waypoint = new Waypoint(currentState.name, currentState.type, own);
        waypoint.setGeocode(geocode);
        waypoint.setPrefix(prefix);
        waypoint.setLookup(lookup);
        waypoint.setCoordsPure(currentState.coords);
        waypoint.setPreprojectedCoords(currentState.preprojectedCoords);
        waypoint.setNote(currentState.noteText);
        waypoint.setUserNote(currentState.userNoteText);
        waypoint.setVisited(currentState.visited);
        waypoint.setId(waypointId);
        waypoint.setOriginalCoordsEmpty(originalCoordsEmpty);
        waypoint.setCalcStateConfig(currentState.calcStateJson);
        waypoint.setProjection(currentState.projectionType, currentState.projectionUnits,
                currentState.projectionFormula1, currentState.projectionFormula2);

        final Geocache cache = DataStore.loadCache(geocode, LoadFlags.LOAD_WAYPOINTS);
        if (cache == null) {
            finishHandler.sendEmptyMessage(SAVE_ERROR);
            return;
        }
        final String oldAllUserNotes = cache.getAllUserNotes();
        if (cache.addOrChangeWaypoint(waypoint, true)) {
            cache.addCacheArtefactsFromNotes(oldAllUserNotes);
            boolean deleteModifiedOnline = false;
            if (waypoint.getCoords() != null && (binding.modifyCacheCoordinatesLocal.isChecked() || binding.modifyCacheCoordinatesLocalAndRemote.isChecked())) {
                if (waypoint.getWaypointType() == WaypointType.ORIGINAL) {
                    deleteModifiedOnline = true;
                    cache.resetUserModifiedCoords(waypoint);
                } else {
                    if (!cache.hasUserModifiedCoords()) {
                        cache.createOriginalWaypoint(cache.getCoords());
                    }
                    cache.setCoords(waypoint.getCoords());
                    DataStore.saveUserModifiedCoords(cache);
                }
            }
            if (waypoint.getCoords() != null && binding.modifyCacheCoordinatesLocalAndRemote.isChecked()) {
                finishHandler.sendEmptyMessage(UPLOAD_START);

                if (cache.supportsOwnCoordinates()) {
                    final boolean result = deleteModifiedOnline ? deleteModifiedCoords(cache) : uploadModifiedCoords(cache, waypoint.getCoords());
                    finishHandler.sendEmptyMessage(result ? UPLOAD_SUCCESS : UPLOAD_ERROR);
                } else {
                    ActivityMixin.showApplicationToast(getString(R.string.waypoint_coordinates_couldnt_be_modified_on_website));
                    finishHandler.sendEmptyMessage(UPLOAD_NOT_POSSIBLE);
                }
            } else {
                finishHandler.sendEmptyMessage(SUCCESS);
            }
        } else {
            finishHandler.sendEmptyMessage(SAVE_ERROR);
        }

        GeocacheChangedBroadcastReceiver.sendBroadcast(this, cache.getGeocode());
    }
Save the current state of the calculator such that it can be restored after screen rotation (or similar)
main/src/main/java/cgeo/geocaching/EditWaypointActivity.java