Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- StringRequest jsonObjRequest = new StringRequest(Request.Method.POST, URL,
- new Response.Listener<String>() {
- @Override
- public void onResponse(String response) {
- System.out.println("hellooo");
- }
- }, new Response.ErrorListener() {
- @Override
- public void onErrorResponse(VolleyError error) {
- System.out.println("error");
- }
- }) {
- @Override
- public String getBodyContentType() {
- return "application/x-www-form-urlencoded; charset=UTF-8";
- }
- @Override
- protected Map<String, String> getParams() throws AuthFailureError {
- Map<String, String> params = new HashMap<String, String>();
- params.put("username", "hello");
- params.put("password", "hellooo");
- return params;
- }
- };
- queue.add(jsonObjRequest);
- Retrofit retrofit = new Retrofit.Builder()
- .baseUrl(URL)
- .addConverterFactory(GsonConverterFactory.create())
- .build();
- testAPI testapi = retrofit.create(testAPI.class);
- String hello = "hello";
- Call<Message> call = testapi.sendData(hello);
- call.enqueue(new Callback<Message>() {
- @Override
- public void onResponse(Response<Message> response) {
- System.out.println(response);
- }
- @Override
- public void onFailure(Throwable t) {
- System.out.println(t);
- }
- });
- Ion.with(getContext())
- .load("https://koush.clockworkmod.com/test/echo")
- .setBodyParameter("goop", "noop")
- .setBodyParameter("foo", "bar")
- .asString()
- .setCallback(...)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement