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

后端 未结 10 1962
独厮守ぢ
独厮守ぢ 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-13 09:02

    You should call stopAutoManage() in the onDestroy() method of your fragment like so:

         @Override
            public void onDestroy() {
                 super.onDestroy();
                 mGoogleApiClient.stopAutoManage(getActivity());
                 mGoogleApiClient.disconnect();
              }
    

提交回复
热议问题