If you use showDialog(int), the activity will call through to
this method the first time, and hang onto it thereafter. Any dialog
that is created by this method will automatically be saved and restored
for you, including whether it is showing.
當(dāng)你調(diào)用showDialog(int )方法時,系統(tǒng)會自動調(diào)用此方法,如果是第一次調(diào)用,會根據(jù)你對onCreateDialog(int ,Bundle)的實現(xiàn)創(chuàng)建此Dialog,然后系統(tǒng)為你保存下此dialog,以備下次再調(diào)用showDialog(int)方法時直接展現(xiàn)系統(tǒng)為你保存的此Dialog,而不會再調(diào)用onCreateDialog(int ,Bundle ) 方法去創(chuàng)建Dialog。
如果你想要系統(tǒng)為你管理保存dialogs,你就得自己重寫這個方法。當(dāng)然你也可以不選擇此方法,隨時用,隨時創(chuàng)建。
若你想讓系統(tǒng)調(diào)用此方法之前做點什么,你可以重寫onPrepareDialog(int, Dialog, Bundle)方法。