public class JsonHttpResponseHandler extends AsyncHttpResponseHandler
限定符和类型 | 字段和说明 |
---|---|
protected static int |
SUCCESS_JSON_MESSAGE |
FAILURE_MESSAGE, FINISH_MESSAGE, START_MESSAGE, SUCCESS_MESSAGE
构造器和说明 |
---|
JsonHttpResponseHandler() |
JsonHttpResponseHandler(Context context) |
限定符和类型 | 方法和说明 |
---|---|
protected void |
handleFailureMessage(Throwable e,
String responseBody) |
protected void |
handleMessage(Message msg) |
protected void |
handleSuccessJsonMessage(int statusCode,
Object jsonResponse) |
void |
onFailure(Throwable e,
JSONArray errorResponse) |
void |
onFailure(Throwable e,
JSONObject errorResponse) |
void |
onSuccess(int statusCode,
JSONArray response)
Fired when a request returns successfully and contains a json array
at the base of the response string.
|
void |
onSuccess(int statusCode,
JSONObject response)
Fired when a request returns successfully and contains a json object
at the base of the response string.
|
void |
onSuccess(JSONArray response)
Fired when a request returns successfully and contains a json array
at the base of the response string.
|
void |
onSuccess(JSONObject response)
Fired when a request returns successfully and contains a json object
at the base of the response string.
|
protected Object |
parseResponse(String responseBody) |
protected void |
sendSuccessMessage(int statusCode,
String responseBody) |
handleSuccessMessage, obtainMessage, onFailure, onFinish, onStart, sendFailureMessage, sendFailureMessage, sendFinishMessage, sendMessage, sendStartMessage
protected static final int SUCCESS_JSON_MESSAGE
public JsonHttpResponseHandler()
public JsonHttpResponseHandler(Context context)
public void onSuccess(JSONObject response)
onSuccess
在类中 AsyncHttpResponseHandler
response
- the parsed json object found in the server response (if any)public void onSuccess(JSONArray response)
onSuccess
在类中 AsyncHttpResponseHandler
response
- the parsed json array found in the server response (if any)public void onSuccess(int statusCode, JSONObject response)
onSuccess
在类中 AsyncHttpResponseHandler
statusCode
- the status code of the responseresponse
- the parsed json object found in the server response (if any)public void onSuccess(int statusCode, JSONArray response)
onSuccess
在类中 AsyncHttpResponseHandler
statusCode
- the status code of the responseresponse
- the parsed json array found in the server response (if any)public void onFailure(Throwable e, JSONObject errorResponse)
onFailure
在类中 AsyncHttpResponseHandler
public void onFailure(Throwable e, JSONArray errorResponse)
onFailure
在类中 AsyncHttpResponseHandler
protected void sendSuccessMessage(int statusCode, String responseBody)
protected void handleMessage(Message msg)
protected void handleSuccessJsonMessage(int statusCode, Object jsonResponse)
protected Object parseResponse(String responseBody) throws JSONException
JSONException