Created
October 11, 2014 17:20
-
-
Save guilhermecarvalhocarneiro/c540a66ab75270474b41 to your computer and use it in GitHub Desktop.
Gists de tentativa de consumo da API passando o objeto Posto para o método.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| AsyncHttpClient client = new AsyncHttpClient(); | |
| RequestParams params = new RequestParams(); | |
| params.put("valor_etanol", this.valorEtanol); | |
| params.put("valor_gasolina", this.valorGasolina); | |
| params.put("valor_diesel", this.valorDiesel); | |
| params.put("posto", "COMO INSERIR AQUI O OBJETO POSTO?"); | |
| client.addHeader("Authorization", String.format("Token %s", token)); | |
| client.post(uri, params, new AsyncHttpResponseHandler() { | |
| @Override | |
| public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { | |
| Log.e("Price", String.valueOf(statusCode)); | |
| resultadoInsertPrice = true; | |
| } | |
| @Override | |
| public void onFailure(int statusCode, Header[] headers, | |
| byte[] responseBody, Throwable error) { | |
| Log.e("Price", String.valueOf(headers)); | |
| resultadoInsertPrice = false; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment