代码之家  ›  专栏  ›  技术社区  ›  Expert wanna be

Android popBackStackImmediate无法删除Glide的SupportRequestManagerFragment

  •  0
  • Expert wanna be  · 技术社区  · 6 年前
    activity.supportFragmentManager.popBackStackImmediate()
    

    PopBackbackImmediate无法移除Glide的SupportRequestManagerFragment,你知道为什么吗?还有没有其他方法可以从片段堆栈中删除SupportRequestManagerFragment?

    2 回复  |  直到 6 年前
        1
  •  2
  •   EpicPandaForce Jigar Joshi    6 年前

    看到了吗 code .

    pendingSupportRequestManagerFragments.put(fm, current);
    fm.beginTransaction().add(current, FRAGMENT_TAG).commitAllowingStateLoss(); // <-- no addToBackStack() call
    

    fragmentManager.getFragments() if(fragment instanceof SupportRequestManagerFragment) ,如果是,则使用片段事务将其删除。但这似乎不是个好主意。^_^

        2
  •  10
  •   Amit Tumkur    6 年前

    这个案例片段使用活动上下文而不是Glide的片段上下文。

    Glide.with(getActivity()).load("url").into(imageView)
    

    Here

    Glide.with(this.getActivity().getBaseContext()).load("url").into(imageView)