Error in Fragment: “Already managing a GoogleApiClient with id 0”

后端 未结 10 1964
独厮守ぢ
独厮守ぢ 2020-12-13 08:16

Everything works right the first time, if you launch a second time you see this error:

FATAL EXCEPTION: main
Process         


        
10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-13 08:46

    I suggest that you initialize your mGoogleApiClient in onCreate() instead of in onCreateView().

    As pointed out by @vlazzle, onCreateView() can be called more than once during a single Activity's lifespan.

提交回复
热议问题