本文整理匯總了Java中com.loopj.android.http.RequestParams.setUseJsonStreamer方法的典型用法代碼示例。如果您正苦於以下問題:Java RequestParams.setUseJsonStreamer方法的具體用法?Java RequestParams.setUseJsonStreamer怎麽用?Java RequestParams.setUseJsonStreamer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.loopj.android.http.RequestParams
的用法示例。
在下文中一共展示了RequestParams.setUseJsonStreamer方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: executeSample
import com.loopj.android.http.RequestParams; //導入方法依賴的package包/類
@Override
public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[] headers, HttpEntity entity, ResponseHandlerInterface responseHandler) {
RequestParams params = new RequestParams();
params.setUseJsonStreamer(true);
JSONObject body;
if (isRequestBodyAllowed() && (body = getBodyTextAsJSON()) != null) {
try {
Iterator keys = body.keys();
Log.d(LOG_TAG, "JSON data:");
while (keys.hasNext()) {
String key = (String) keys.next();
Log.d(LOG_TAG, " " + key + ": " + body.get(key));
params.put(key, body.get(key).toString());
}
} catch (JSONException e) {
Log.w(LOG_TAG, "Unable to retrieve a JSON value", e);
}
}
return client.post(this, URL, headers, params,
RequestParams.APPLICATION_JSON, responseHandler);
}
示例2: executeSample
import com.loopj.android.http.RequestParams; //導入方法依賴的package包/類
@Override
public RequestHandle executeSample(AsyncHttpClient client, String URL, Header[] headers, HttpEntity entity, ResponseHandlerInterface responseHandler) {
try {
RequestParams params = new RequestParams();
final String contentType = RequestParams.APPLICATION_OCTET_STREAM;
params.put("fileOne", createTempFile("fileOne", 1020), contentType, "fileOne");
params.put("fileTwo", createTempFile("fileTwo", 1030), contentType);
params.put("fileThree", createTempFile("fileThree", 1040), contentType, "customFileThree");
params.put("fileFour", createTempFile("fileFour", 1050), contentType);
params.put("fileFive", createTempFile("fileFive", 1060), contentType, "testingFileFive");
params.setHttpEntityIsRepeatable(true);
params.setUseJsonStreamer(false);
return client.post(this, URL, params, responseHandler);
} catch (FileNotFoundException fnfException) {
Log.e(LOG_TAG, "executeSample failed with FileNotFoundException", fnfException);
}
return null;
}