Update a TextView in a ViewPager from another Fragment

前端 未结 4 1744
有刺的猬
有刺的猬 2021-01-07 17:23

I am trying to update a TextView in a Fragment clicking on a button on another Fragment.

Actually I implemented the callback function to the Activity and it does wor

4条回答
  •  无人及你
    2021-01-07 17:59

    My guess is that this is case of "overlapping" fragments - not uncommon to those trying out Fragments for the first time. Everytime you re-display a Fragment (display a Fragment, show another, then go back to the first fragment you displayed), you're creating a new Fragment behind the visible fragment. The "mirror fragment" remains on top, blocking your view to the fragment behind it. Only by scrolling that fragment will you see that the fragment behind really does get updated.

    Most of the time it's just a case of you repeating what you did in XML in your FragmentActivity. Post your layout xml's so the fragment pros can diagnose your problem better.

提交回复
热议问题