I am trying to run below code:
Map<String, Object> requestMap = new HashMap<>();
Long unixTime = System.currentTimeMillis() / LONG_1000;
requestMap.put(KEY_TIME, unixTime);
JWTSigner signer = new JWTSigner(SECRET);
String token = signer.sign(requestMap);
String url = BASE_URI + "/Data/Categories?d=" + token;
StringRequest stringRequest = new StringRequest(Request.Method.GET, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG, response);
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e(TAG, error.getLocalizedMessage());
}
});
RequestQueue mRequestQueue = Volley.newRequestQueue(getActivity());
mRequestQueue.add(stringRequest);
But I am getting following error:
[6056] NetworkDispatcher.run: Unhandled exception java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
at com.android.volley.toolbox.HttpHeaderParser.parseCharset(HttpHeaderParser.java:243)
at com.android.volley.toolbox.HttpHeaderParser.parseCharset(HttpHeaderParser.java:262)
at com.android.volley.request.StringRequest.parseNetworkResponse(StringRequest.java:70)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:133)
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.Object java.util.Map.get(java.lang.Object)' on a null object reference
I have no idea what is to problem. Can anyone help?
Thanks in advance.