Fragment not attached to a context

前端 未结 7 1254
鱼传尺愫
鱼传尺愫 2020-12-14 14:58

In activity in Toolbar I got a button which need to call method from fragment and update list in that fragment. Now it is an error. Calling in activity

@Over         


        
7条回答
  •  悲哀的现实
    2020-12-14 15:46

    In my case, this problem occurred when I was calling getString()

    changing this calls to getActivity().getString() solved the problem.

提交回复
热议问题