开发者

How do keep CustomDialog when its activity is finished?

I have a custom dialog which is displaying fine, but it immediately gets closed because its activity's finish method is called immediately after it's displayed. Previously, I was using a t开发者_如何学Gooast message, and this had no problem staying up in the same circumstances.

I'm pretty sure the problem is that the custom dialog, unlike the Toast message, "belongs" to the Activity, so when the activity goes away, the dialog goes away too. I was thinking of adding listener with setOnShowListener, but I don't think that will work - unless the listener somehow blocks the finish. I could add a timer delay, but that's not a very attractive solution. What is a good solution here?


I think its better to display the another activity as a dialog.

Simply add this to the new activity which should be displayed as a dialog,

<activity android:theme="@android:style/Theme.Translucent">
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜