Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fragment BackStack clears after loading the Image using Glide Image Library

I have used Glide for image loading (Image which is inside my fragment). And handle the fragment backstack on backpress for navigating between the fragments. After loading the image my fragment backstack replaces with following fragment

com.bumptech.glide.manager.SupportRequestManagerFragment

entry so I'm unable to handle the backstack now, I don't want the glide SupportRequestManagerFragment to be attach in the fragment backstack also I have read the glide doc in the following link

http://bumptech.github.io/glide/javadocs/360/com/bumptech/glide/Glide.html#with%28android.support.v4.app.Fragment%29

They have mentioned that that passing context will attach the Glide to Application life cycle based on the context parameter. Now my requirement is that without affecting the fragment backstack how to load the image using glide, is it possible? or is there any other way to do it by configuring the Glide options?

Anyone help me or suggest the way to over come this issue?

like image 994
Somasundaram NP Avatar asked Feb 23 '17 14:02

Somasundaram NP


1 Answers

I have loaded the Glide with Fragment context

so that com.bumptech.glide.manager.SupportRequestManagerFragment

attached to the backstack, in-order to avoid the SupportRequestManagerFragment entry in backstack I have loaded the Glide with getApplicationContext() as mention in the below url.

http://bumptech.github.io/glide/javadocs/330/com/bumptech/glide/Glide.html#with%28android.content.Context%29

like image 106
Somasundaram NP Avatar answered Sep 28 '22 08:09

Somasundaram NP