private void repondre(Invitation i, String newState, View v) { final View view = v; Map<String, String> params = new HashMap<>(); params.put("action", Actions.REPONDRE_INVITATION.toString()); params.put("id_google", id_google); params.put("id_invitation", i.getId()); params.put("reponse", newState); Log.i(TAG, "Modifying the invitation..."); mSyncNetworkResponses.addTransaction(); ApiClient.post( getString(R.string.url_api), new RequestParams(params), new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { try { boolean success = response.getBoolean("success"); if (success) { Log.i(TAG, "The modification has been made"); mSyncNetworkResponses.removeTransaction(); } else { sendDialog( "Une erreur s'est produite lors de la modification du statut.\n Veuillez réessayer."); } } catch (JSONException e) { Log.e( TAG, "ERROR while retriving data from JSONObject " + "representing success of modifying the state of an invitation : \n" + e.getMessage()); } } @Override public void onFailure( int statusCode, Header[] headers, String responseString, Throwable throwable) { Log.e(TAG, "statusCode : " + statusCode); Log.e(TAG, "\n response : " + responseString); } }); }