Search in sources :

Example 11 with CustomRequest

use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.

the class NoteService method putNoteStudent.

private void putNoteStudent(final JSONObject dataToSend) {
    CustomRequest jsonReq = new CustomRequest(Request.Method.POST, POST_NOTE, null, new Response.Listener<JSONObject>() {

        @Override
        public void onResponse(JSONObject response) {
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
        // hidepDialog();
        }
    }) {

        @Override
        protected Map<String, String> getParams() {
            Map<String, String> params = new HashMap<String, String>();
            try {
                params.put("reason", dataToSend.getString("reason"));
                params.put("value", dataToSend.getString("note"));
                params.put("student", dataToSend.getString("student"));
                params.put("module", dataToSend.getString("_id"));
                params.put("modulename", dataToSend.getString("_name"));
            } catch (JSONException e) {
                e.printStackTrace();
            }
            return params;
        }
    };
    App.getInstance().addToRequestQueue(jsonReq);
}
Also used : Response(com.android.volley.Response) VolleyError(com.android.volley.VolleyError) JSONObject(org.json.JSONObject) HashMap(java.util.HashMap) JSONException(org.json.JSONException) CustomRequest(dz.easy.androidclient.Util.CustomRequest)

Example 12 with CustomRequest

use of dz.easy.androidclient.Util.CustomRequest in project easy by MehdiBenmesa.

the class TimeTableManagerAdapter method getAllGroups.

public void getAllGroups() {
    CustomRequest jsonReq = new CustomRequest(Request.Method.GET, GET_ALL_GROUPS, null, new Response.Listener<JSONObject>() {

        @Override
        public void onResponse(JSONObject response) {
        }
    }, new Response.ErrorListener() {

        @Override
        public void onErrorResponse(VolleyError error) {
        }
    });
    App.getInstance().addToRequestQueue(jsonReq);
}
Also used : Response(com.android.volley.Response) VolleyError(com.android.volley.VolleyError) JSONObject(org.json.JSONObject) CustomRequest(dz.easy.androidclient.Util.CustomRequest)

Aggregations

VolleyError (com.android.volley.VolleyError)12 CustomRequest (dz.easy.androidclient.Util.CustomRequest)12 JSONObject (org.json.JSONObject)12 JSONException (org.json.JSONException)10 Response (com.android.volley.Response)9 HashMap (java.util.HashMap)8 Iterator (java.util.Iterator)3 Map (java.util.Map)3 JSONArray (org.json.JSONArray)3 GoogleSignInAccount (com.google.android.gms.auth.api.signin.GoogleSignInAccount)1