How add multiple geoQuery from JSON geofire

53 views Asked by At

I build an app with geofire, that it show multiple listeners from JSON, but i cant do, I try with the follow way, work, but when i try of remove any listener, crash, what way it can work for multiple listeners from JSON?

This is my fragment code

StringRequest strReq = new StringRequest(Request.Method.POST, URL, new Response.Listener<String>() {

            @Override
            public void onResponse(String response) {
                Log.e("Response: ", response);

                try {
                    JSONObject jObj = new JSONObject(response);
                    String getObject = jObj.getString("saagMRK");
                    JSONArray jsonArray = new JSONArray(getObject);    

                    for (int i = 0; i < jsonArray.length(); i++) {
                        JSONObject jsonObject = jsonArray.getJSONObject(i);

                        latLng = new LatLng(parseDouble(jsonObject.getString(LAT)), parseDouble(jsonObject.getString(LNG)));

                        geofire.queryAtLocation(new GeoLocation(latLng.latitude,latLng.longitude), 0.1f);    
                        geoQuery.addGeoQueryEventListener(new GeoQueryEventListener()... 


                    }

                } catch (JSONException e) {
                  e.printStackTrace();

            }...
0

There are 0 answers