Source:
<code>public static void addPlace(final Context context, String name, LatLng latLng) throws JSONException { Log.e(TAG, "addPlace"); AQuery aq = new AQuery(context); String userId = PreferenceUtils.getValue(context, PreferenceUtils.KEY_USER_ID); String authorizationToken = PreferenceUtils.getValue(context, PreferenceUtils.KEY_AUTH_TOKEN); String url = ApiUrl + "user/" + userId + "/place"; String cleanName = name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase(); JSONObject JSONdata = new JSONObject() .put("lat", latLng.latitude) .put("lon", latLng.longitude) .put("rad", 100) .put("img", "") .put("name", cleanName); AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>() { @Override public void callback(String url, JSONObject object, AjaxStatus status) { Log.e(TAG, "addPlace result code: " + status.getCode()); Log.e(TAG, "addPlace result message: " + status.getMessage()); Log.e(TAG, "addPlace ERROR: " + status.getError()); if (status.getError() != null) { handleError(status); return; } Log.e(TAG, "No error, place created."); Toast.makeText(context, context.getResources().getString(R.string.place_created), Toast.LENGTH_SHORT).show(); DataService.getPlaces(context); } private void handleError(AjaxStatus status) { if (status.getCode() == 403) { int message = -1; switch (status.getError()) { <START> case "place_limit_reached": <END> message = R.string.place_limit_reached; break; case "place_name_already_in_use": message = R.string.place_name_already_in_use; break; } if (message != -1) { Toast.makeText(context, context.getResources().getString(message), Toast.LENGTH_SHORT).show(); } } } }; cb.header("authorizationtoken", authorizationToken); aq.post(url, JSONdata, JSONObject.class, cb); }</code><technical_language>this is way. Enums something</technical_language>

Target:
public static void addPlace(final Context context, String name, LatLng latLng) throws JSONException { Log.e(TAG, "addPlace"); AQuery aq = new AQuery(context); String userId = PreferenceUtils.getValue(context, PreferenceUtils.KEY_USER_ID); String authorizationToken = PreferenceUtils.getValue(context, PreferenceUtils.KEY_AUTH_TOKEN); String url = ApiUrl + "user/" + userId + "/place"; String cleanName = name.substring(0, 1).toUpperCase() + name.substring(1).toLowerCase(); JSONObject JSONdata = new JSONObject() .put("lat", latLng.latitude) .put("lon", latLng.longitude) .put("rad", 100) .put("img", "") .put("name", cleanName); AjaxCallback<JSONObject> cb = new AjaxCallback<JSONObject>() { @Override public void callback(String url, JSONObject object, AjaxStatus status) { Log.e(TAG, "addPlace result code: " + status.getCode()); Log.e(TAG, "addPlace result message: " + status.getMessage()); Log.e(TAG, "addPlace ERROR: " + status.getError()); if (status.getError() != null) { handleError(status); return; } Log.e(TAG, "No error, place created."); Toast.makeText(context, context.getResources().getString(R.string.place_created), Toast.LENGTH_SHORT).show(); DataService.getPlaces(context); } private void handleError(AjaxStatus status) { AddPlaceError ape = AddPlaceError.getEnum(status.getError()); if (ape == null) { return; } String toastMessage = context.getResources().getString(ape.getErrorMessage()); Toast.makeText(context, toastMessage, Toast.LENGTH_SHORT).show(); } }; cb.header("authorizationtoken", authorizationToken); aq.post(url, JSONdata, JSONObject.class, cb); }