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 )方法時(shí),系統(tǒng)會(huì)自動(dòng)調(diào)用此方法,如果是第一次調(diào)用,會(huì)根據(jù)你對(duì)onCreateDialog(int ,Bundle)的實(shí)現(xiàn)創(chuàng)建此Dialog,然后系統(tǒng)為你保存下此dialog,以備下次再調(diào)用showDialog(int)方法時(shí)直接展現(xiàn)系統(tǒng)為你保存的此Dialog,而不會(huì)再調(diào)用onCreateDialog(int ,Bundle ) 方法去創(chuàng)建Dialog。
如果你想要系統(tǒng)為你管理保存dialogs,你就得自己重寫(xiě)這個(gè)方法。當(dāng)然你也可以不選擇此方法,隨時(shí)用,隨時(shí)創(chuàng)建。
若你想讓系統(tǒng)調(diào)用此方法之前做點(diǎn)什么,你可以重寫(xiě)onPrepareDialog(int, Dialog, Bundle)方法。
id | The id of the dialog. |
---|---|
args | The dialog arguments provided to showDialog(int, Bundle). |
歡迎光臨 Chinaunix (http://www.72891.cn/) | Powered by Discuz! X3.2 |