RequestParams params = new RequestParams(); params.put("notes", "Test api support"); client.post(restApiUrl, params, responseHandler);
RequestParams rp = new RequestParams(); rp.add("username", "aaa"); rp.add("password", "aaa@123"); HttpUtils.post(AppConstant.URL_FEED, rp, new JsonHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, JSONObject response) { // If the response is JSONObject instead of expected JSONArray Log.d("asd", "---------------- this is response : " + response); try { JSONObject serverResp = new JSONObject(response.toString()); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void onSuccess(int statusCode, Header[] headers, JSONArray timeline) { // Pull out the first event on the public timeline } }); }
Context context = this; String url = "http://*.*.*.*:8080/someurl"; UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(ApplicationConstants.userName, ApplicationConstants.password); Header header = BasicScheme.authenticate(credentials, "UTF-8", false); Header[] headers = {header}; RequestParams params = new RequestParams(); httpClient.get(context, url, headers, params, new AsyncHttpResponseHandler(){ ..
Set RequestParams data = new RequestParams(); if (file != null && file.exists()) data.put("Db_file", new FileInputStream(file)); data.setForceMultipartEntityContentType(true);
ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 85, out); byte[] myByteArray = out.toByteArray(); RequestParams params = new RequestParams(); params.put("profile_picture", new ByteArrayInputStream(myByteArray), "image.png");
RequestParams params = new RequestParams(); params.put("A_KEY_TO_IDENTIFY_YOUR_STRING", "THE_STRING_YOU_WANT_TO_SEND"); AsyncHttpClient client = new AsyncHttpClient(); client.post("http://www.yourserver.com", params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { // handle your response from the server here System.out.println(response); } });
AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.put("q", "google"); client.post("http://google.com", params, new AsyncHttpResponseHandler(){ public void onSuccess(String arg0) { Log.d("TAG", "Success"); }; public void onFailure(Throwable arg0, String arg1) { Log.d("TAG", "Failure"); }; });
RequestParams params = new RequestParams(); JSONArray arrayName = new JSONArray(); JSONArray arrayContact = new JSONArray(); for(i = 0;i < contacts.size();i++ ) { arrayName.put(contacts.get(i).getName()); arrayContact.put(contacts.get(i).getContact()); } params.put("ContactNameArray",arrayName); params.put("ContactNumberArray",arrayContact);
File myVideo = new File("/path/to/myvideo.mp4"); File myPic = new File("/path/to/mypic.jpg"); RequestParams params = new RequestParams(); try { params.put("profile_picture", myPic); params.put("my_video", myVideo); } catch(FileNotFoundException e) {}
RequestParams params = new RequestParams(); params.put("fileTitle","MyFile1"); params.put("file", new File("File Path Here")); // e.g Environment.getExternalStorageDirectory().getPath() + "/test.mp3" AsyncLoader asyncUploader = new AsyncLoader(this, "URL_HERE", params, callHandler); asyncUploader.startTransfer();
RequestParam params = new RequestParams(); params.put("key1", "value1"); params.put("key2", "value2"); File imgFile = new File(filePath); try { params.put("file",imgFile); } catch(FileNotFoundException e) {} AsyncHttpClient image = new AsyncHttpClient(); image.post(uploadURL, params, new AsyncHttpResponseHandler(){});
Map<String, String> aMap = new HashMap<String, String>(); aMap.put("f_name" ,""); aMap.put("l_name" ,""); aMap.put("email" ,edtEmail.getText().toString()); RequestParams params = new RequestParams(); params.put("user",aMap); AsyncHttpClient client = new AsyncHttpClient(); client.post(url, params, n.....
private boolean doLogIn(String user, String pass) { //boolean result = false; if (user.trim().isEmpty() || pass.trim().isEmpty()) { return false; } RequestParams params = new RequestParams(); params.add("user", user); params.add("pass", pass); MyTextHttpResponseHandler myTextHttpResponseHandler = new MyTextHttpResponseHandler(this); ApiInterface.get4Login("Auth", params, myTextHttpResponseHandler); return myTextHttpResponseHandler.getResult(); }
public static void registerGCMID(final String regID, final String userID) { final RequestParams params = new RequestParams(); params.put(WSConstant.PRM_USER_ID, userID); params.put(WSConstant.PRM_DEVICE_ID, regID); AppInBoxWS.syncPost("update_device_id", params); }
public class RegisterController{ private RegisterServer serverSide; public RegisterController(RegisterServer r){ serverSide = r; } public void registerToServer(String email,String password) { RequestParams params = new RequestParams(); params.put("email", email); params.put("password", password); serverSide.registerToServer(params); } }
RequestParams params = new RequestParams(); try { params.put("photo", FragmentPhotoCrop.croppedFile, "image/jpeg"); // croppedFile is a FIle params.setUseJsonStreamer(false); } catch (FileNotFoundException e) { } asyncHttpClient.put(getActivity(), url, params, new AsyncHttpResponseHandler() { .. //enter code here }
RequestParams rp = new RequestParams(); rp.put("Email", "aaa@tbbb.com"); rp.put("Password", "123456"); Utils.client.get(url, rp, new AsyncHttpResponseHandler() { //or your http code
RequestParams params= new RequestParams(); //params.put("file", new File(filePath)); params.put("file", new File(filePath), contentType); AsyncHttpClient client = new AsyncHttpClient(); //client.post(url, params, listener); client.put(url, params, listener);
AsyncHttpClient client = new AsyncHttpClient(); String filename = "file.png"; File myFile = new File("/path/to/" + filename); RequestParams params = new RequestParams(); try { params.put("file", myFile); params.put("filename", filename); client.post("http://192.168.1.105:8080/ATestInternetCameraServlet/CameraServlet", params, responseHandler); } catch(FileNotFoundException e) { // handle }
AsyncHttpClient client = new AsyncHttpClient(); RequestParams params = new RequestParams(); params.put("email", "u"); params.put("password", "pass"); client.post("http://host?method=signIn", params, new AsyncHttpResponseHandler() { @Override public void onSuccess(String response) { // handle response here } });