I am using volley library for making web-services call. I made a general class for making all web services call and making service call from there and made anonymous listene
I had a similar problem detected with LeakCanary where Volley's mListener was referencing my response listener, and my listener was referencing an ImageView, so it could update it with the downloaded image.
I made my response listener an inner class within the activity ..
private class MyVolleyResponseListener implements com.android.volley.Response.Listener {
@Override
public void onResponse(Bitmap bitmap) {
thumbNailView.setImageBitmap(bitmap);
}
}
.. and stopped and started the volley request queue inside onDestroy() in the activity ..
requestQueue.stop();
requestQueue.start();
This has fixed the leak.