i'm using volley library to receive data from json file I have this problem i don't know the reason for this error
Attempt to invoke virtual method 'android.content.Context.getResources()' on a null object reference
  private void fetchRemoteData(final DataStatus callback){
    StringRequest stringRequest = new StringRequest(Request.Method.GET,
            URL_DATA,
            new Response.Listener<String>() {
                @Override
                public void onResponse(String s) {
                    List<Post> listItems = new ArrayList<>();
                    try {
                        JSONObject jsonObject = new JSONObject(s);
                        JSONArray array = jsonObject.getJSONArray("bgs");
                        for (int i = 0; i < array.length(); i++){
                            JSONObject o = array.getJSONObject(i);
                            Post item = new Post(
                                    o.getString("img")
                            );
                            listItems.add(item);
                        }
                        callback.onSuccess(listItems);
                    } catch (JSONException e) {
                    }
                }
            },
            new Response.ErrorListener() {
                @Override
                public void onErrorResponse(VolleyError error) {
                    callback.onError(error);
                }
            });
    RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
    requestQueue.add(stringRequest);
}
error exist here :
@Override
                public void onErrorResponse(VolleyError error) {
                    callback.onError(error);
                }
 
     
    