Last active
August 29, 2015 14:10
-
-
Save sheharyarn/950561cd3d4487f69e46 to your computer and use it in GitHub Desktop.
Using AndroidAsyncHttp Library
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
RequestParams params = new RequestParams(); | |
params.put("email", "[email protected]"); | |
params.put("password", "12345678"); | |
APIClient.post("/login", params, new JsonHttpResponseHandler() { | |
// @Override them all | |
public void onStart() { } // Runs before anything else | |
public void onFinish() { } // Runs after everything else | |
// If don't know your response type | |
public void onSuccess(int statusCode, Header[] headers, byte[] response) { } | |
public void onFailure(int statusCode, Header[] headers, byte[] errorResponse, Throwable e) { } | |
// If your responses are simple text | |
public void onSuccess(int statusCode, Header[] headers, String response) { } | |
public void onFailure(int statusCode, Header[] headers, String error, Throwable throwable) { } | |
// If your responses are JSON Objects (or Arrays) | |
public void onSuccess(int statusCode, Header[] headers, JSONObject response) { } | |
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONObject error) { } | |
public void onSuccess(int statusCode, Header[] headers, JSONArray response) { } | |
public void onFailure(int statusCode, Header[] headers, Throwable throwable, JSONArray errors) { } | |
// Fuck me, right? | |
// You can use more than one at a time | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment