android maps, markers and memory leaks

后端 未结 1 1977
半阙折子戏
半阙折子戏 2021-01-06 17:11

I was reading the android docs http://developer.android.com/reference/com/google/android/gms/maps/MapFragment.html and I came across this sentence:

A

相关标签:
1条回答
  • 2021-01-06 17:39

    If you look at a fragments lifecycle you can see that the view may be destroyed while the fragment still lives. It can also recreate the view before the fragment is destroyed. This just means you should cleanup and create all markers in the onCreateView and onDestroyView callbacks instead. If you use those callbacks for marker manipulation you should be fine.

    0 讨论(0)
提交回复
热议问题