use of com.android.volley.Response in project FastDev4Android by jiangqqlmj.
the class Fdv_JsonArrayRequest method post.
/**
* POST请求返回JSONArray对象
* @param url 请求地址
* @param listener 请求数据返回回调接口
* @param params POST请求参数
*/
public void post(String url, final Fdv_CallBackListener<JSONArray> listener, Map<String, String> params) {
JsonArrayRequest jsonArrayRequest = new JsonArrayRequest(Request.Method.POST, url, null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
if (listener != null) {
listener.onSuccessResponse(response);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (listener != null) {
listener.onErrorResponse(error);
}
}
});
addRequest(jsonArrayRequest, params);
}
use of com.android.volley.Response in project FastDev4Android by jiangqqlmj.
the class Fdv_JsonObjectRequest method get.
/**
* 请求返回JSONObject对象 Get请求 无参数,或者get请求的参数直接拼接在URL上面
* @param url 请求地址
* @param listener 数据回调接口
*/
public void get(String url, final Fdv_CallBackListener<JSONObject> listener) {
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.GET, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
if (listener != null) {
listener.onSuccessResponse(response);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (listener != null) {
listener.onErrorResponse(error);
}
}
});
addRequest(jsonObjectRequest);
}
use of com.android.volley.Response in project FastDev4Android by jiangqqlmj.
the class Fdv_JsonObjectRequest method post.
/**
* 发送POST请求, 返回JSONObject对象数据
* @param url 请求地址
* @param listener 数据返回回调接口
* @param params POST请求参数
*/
public void post(String url, final Fdv_CallBackListener<JSONObject> listener, Map<String, String> params) {
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, null, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response) {
if (listener != null) {
listener.onSuccessResponse(response);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (listener != null) {
listener.onErrorResponse(error);
}
}
});
addRequest(jsonObjectRequest, params);
}
use of com.android.volley.Response in project FastDev4Android by jiangqqlmj.
the class Fdv_StringRequest method get.
/**
* 普通文本等信息 Get请求 无参数,或者get请求的参数直接拼接在URL上面
* @param url 请求的地址
* @param listener 数据请求返回接口回调
*/
public void get(String url, final Fdv_CallBackListener<String> listener) {
StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
if (listener != null) {
listener.onSuccessResponse(response);
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
if (listener != null) {
listener.onErrorResponse(error);
}
}
});
addRequest(stringRequest);
}
use of com.android.volley.Response in project easy by MehdiBenmesa.
the class RendezVousFragment method getRendeVousByManager.
private void getRendeVousByManager() {
CustomRequestArray jsonReq = new CustomRequestArray(Request.Method.GET, GET_RDV_BY_TEACHER, null, new Response.Listener<JSONArray>() {
@Override
public void onResponse(JSONArray response) {
if (GRID_LAYOUT) {
recyclerViewRendeVous.setLayoutManager(new GridLayoutManager(getActivity(), 2));
} else {
recyclerViewRendeVous.setLayoutManager(new LinearLayoutManager(getActivity()));
}
recyclerViewRendeVous.setHasFixedSize(true);
//Use this now
recyclerViewRendeVous.addItemDecoration(new MaterialViewPagerHeaderDecorator());
//recyclerViewRendeVous.setAdapter(new TeachersAdapter(response,(TeachersAdapter.AdapterInterface) RendezVousActivity.this));
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
}
});
App.getInstance().addToRequestQueue(jsonReq);
}
Aggregations