How to save CustomDialog when its activity is completed?

I have a custom dialog that displays normally, but it closes immediately, because its completion method is called immediately after it displays. I used to use a toast message, and it had no problem staying in the same circumstances.

I’m sure that the problem is that the user dialog, unlike the Toast message, β€œbelongs” to the activity, so when the activity leaves, the dialog also disappears. I was thinking of adding a listener with setOnShowListener, but I don't think this will work - if the listener somehow does not block the finish. I could add a timer delay, but this is not a very attractive solution. What is a good solution here?

+4
source share
1 answer

I think it’s better to display another action as a dialog.

Just add this to the new action, which should appear as a dialog,

<activity android:theme="@android:style/Theme.Translucent"> 
+2
source

All Articles