com.android.volley.toolbox.JsonRequest Java Examples

The following examples show how to use com.android.volley.toolbox.JsonRequest. 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: GosScheduleSiteTool.java    From Gizwits-SmartBuld_Android with MIT License 6 votes vote down vote up
private void sendDateToSite(String httpurl, JSONObject jsonObject, final OnResponListener respon) {
	JsonRequest<JSONObject> jsonRequest = new JsonObjectRequest(Method.POST, httpurl, jsonObject,
			new Response.Listener<JSONObject>() {
				@Override
				public void onResponse(JSONObject response) {
					Log.i("onSite", "response -> " + response.toString());
					respon.OnRespon(0, response.optString("id"));
				}
			}, new Response.ErrorListener() {
				@Override
				public void onErrorResponse(VolleyError error) {
					respon.OnRespon(1, error.toString());
					error.printStackTrace();
					Log.i("onSite", "sendDateToSite请求失败" + error.toString());
				}
			}) {

		@Override
		public Map<String, String> getHeaders() {
			return getHeaderWithToken();
		}
	};
	mRequestQueue.add(jsonRequest);
}