开发者

How can I guarantee a Dialog will be re-formed after canceled?

I have a dialog that pops up some information on a list, when a long click is performed. The information depends on which list entry the click is performed on. However, I'm noticing that when I view the information, and close it (Via calling it with a dialog.cancel() command), that the next time I open the dialog, it doesn't bother to get the information again, it just pops up the same dialog that I saw before. Any tips for overcoming this problem? Thanks!

Some further information. The dialog is generated using a showDialog(int) command. From there, it is called through an onCreateDialog(int) command in a master activity.

EDIT: I managed to get this to work by using the removeDialog(int) command in the onClickListener of the Dialog (It just removes itself whe开发者_如何学运维n it dies). I can't for the life of me find a more elegant solution, but I'd much prefer one. Thanks guys!

Edit: NM, realized the answer was already posted here... Thanks again!


We could use more info, but are you using onPrepareDialog(int id, Dialog dialog) or onPrepareDialog(int id, Dialog dialog, Bundle args)?

You should let the activity handle the creation and showing of Dialogs. onPrepareDialog will ensure the dialog has the correct info before it is displayed to the user.


You need to rerun the routine that populated the dialog in the first place.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜