com.loopj.android.http.SyncHttpClient Java Examples
The following examples show how to use
com.loopj.android.http.SyncHttpClient.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HttpUtilsAsync.java From UltimateAndroid with Apache License 2.0 | 6 votes |
/** * Upload files with {@link com.loopj.android.http.SyncHttpClient} * * @param url * @param paramsList * @param fileParams * @param files * @param responseHandler */ public static void uploadFiles(String url, List<NameValuePair> paramsList, String fileParams, List<File> files, AsyncHttpResponseHandler responseHandler) throws Exception { SyncHttpClient syncHttpClient = new SyncHttpClient(); RequestParams params = new RequestParams(); if (BasicUtils.judgeNotNull(paramsList)) { for (NameValuePair nameValuePair : paramsList) { params.put(nameValuePair.getName(), nameValuePair.getValue()); } } if (BasicUtils.judgeNotNull(files)) params.put(fileParams, files); syncHttpClient.setTimeout(timeout); syncHttpClient.post(url, params, responseHandler); }
Example #2
Source File: HttpUtilsAsync.java From UltimateAndroid with Apache License 2.0 | 5 votes |
/** * Upload file with {@link com.loopj.android.http.SyncHttpClient} * * @param url * @param paramsList * @param fileParams * @param file * @param responseHandler * @throws FileNotFoundException */ public static void uploadFile(String url, List<NameValuePair> paramsList, String fileParams, File file, AsyncHttpResponseHandler responseHandler) throws FileNotFoundException { SyncHttpClient syncHttpClient = new SyncHttpClient(); RequestParams params = new RequestParams(); if (BasicUtils.judgeNotNull(paramsList)) { for (NameValuePair nameValuePair : paramsList) { params.put(nameValuePair.getName(), nameValuePair.getValue()); } } if (BasicUtils.judgeNotNull(file)) params.put(fileParams, file); syncHttpClient.setTimeout(timeout); syncHttpClient.post(url, params, responseHandler); }