This is related to Glide image loading with application context
I have several Fragments hosted in an Activity, with a Fragment being replaced by another as the user navigates through the app.
I'm passing a RequestManager
into my MyFragment's RecyclerView adapter like so:
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
...
MyAdapter adapter = new MyAdapter(Glide.with(this), listOfPhotos);
recyclerView.setAdapter(adapter);
...
}
My adapter:
public class MyAdapter
extends RecyclerView.Adapter<MyAdapter.ViewHolder> {
private RequestManager mGlide;
...
// constructor
public MyAdapter(RequestManager glide, List<MyStuff> listOfPhotos) {
mGlide = glide;
...
}
...
}
When I debug my app, here's what I see in the object mGlide:
The context
seems to be my project's ApplicationContext
. Now I'm not very familiar with Android contexts, but is this right? I assumed it will be something like com.MyFragment.....
Also, is there a simple way to check if glide is following my fragments' lifecycles?