app/src/main/java/com/mensa/zhmensa/services/PollApi.java
/**
     * Updates a given poll on the Server
     * @param poll
     * @param callback
     * @param ctx
     */
Updates a given poll on the Server
@param poll
@param callback
@param ctx
Updates a given poll on the Server @param poll @param callback @param ctx
static void updatePoll(Poll poll, final Function1<PollApiResponse, Void> callback, final Context ctx) {
          JsonObject payload = convertPollToJsonObj(poll);
          Log.d("updatePoll", payload.toString());
          try {
              HttpUtils.post(BASE_URL + "/update/" + poll.id, payload, ctx,  new AsyncHttpResponseHandler() {
                  @Override
                  public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {
                      callback.invoke(new PollApiResponse(ctx.getString(R.string.update_successfully)));
                  }
                  @Override
                  public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) {
                      callback.invoke(new PollApiResponse(true, (responseBody == null ? "" : new String(responseBody)), error));
                  }
              });
          } catch (UnsupportedEncodingException e) {
              callback.invoke(new PollApiResponse(true, "Unsupported Encoding", e));
          }
      }
static void updatePoll ( Poll poll , final Function1 < PollApiResponse , Void > callback , final Context ctx ) { JsonObject payload = convertPollToJsonObj ( poll ) ; Log . d ( "updatePoll" , payload . toString ( ) ) ; try { HttpUtils . post ( BASE_URL + "/update/" + poll . id , payload , ctx , new AsyncHttpResponseHandler ( ) { @ Override public void onSuccess ( int statusCode , Header [ ] headers , byte [ ] responseBody ) { callback . invoke ( new PollApiResponse ( ctx . getString ( R . string . update_successfully ) ) ) ; } @ Override public void onFailure ( int statusCode , Header [ ] headers , byte [ ] responseBody , Throwable error ) { callback . invoke ( new PollApiResponse ( true , ( responseBody == null ? "" : new String ( responseBody ) ) , error ) ) ; } } ) ; } catch ( UnsupportedEncodingException e ) { callback . invoke ( new PollApiResponse ( true , "Unsupported Encoding" , e ) ) ; } }
Updates a given poll on the Server
 @param poll
 @param callback
 @param ctx
Updates a given poll on the Server @param poll @param callback @param ctx