When to use Android PopupWindow vs Dialog
Asked Answered
C

3

34

I'm unclear about when to use PopupWindow vs Dialog. Any insight would be much appreciated. Thanks.

Crosswise answered 17/1, 2011 at 5:51 Comment(1)
Some context on what you are trying to accomplish would be helpful to answer your question. As of right now it seems to broad to answer (I assume you have read the documentation for both methods already).Correna
B
14

They both use the addView() method along with various windowManager methods. The two are similar in that regard.

Dialogs seem to come with more built-in features for interaction, such as handlers and buttons already included in the base class, while PopupWindows come with more built-in methods for positioning them about the screen.

I think that each of them can do exactly the same as the other, but choosing between the two will be a matter of convenience to the programmer with regards to how you want to use the Object. I'm not a phD in computer science, but I do not think there is a significant difference in processing time between the two based on what I saw in their respective class definitions.

My advice: If you want to have greater control over where your View appears on the display, use a PopupWindow. If you want to add more control and feedback between your View then use a Dialog. If you, like me, want master control over everything, I would suggest a PopupWindow since it has fewer user-evident default methods to override.

Beehive answered 26/4, 2015 at 5:44 Comment(0)
H
5

I think, that you should use Dialog for simple user interaction (YES,NO). I usually use Dialog for simple user interaction and WindowPopup for a little bit more complex view. One example of WindowPopup is AutoCompleteTextView.

Hope it helps.

Hummingbird answered 26/3, 2011 at 19:58 Comment(1)
I have some problems about dialog and popup window! What shoud I choose when I want to sugesst some information to user?Belayneh
T
1

I think Dialog should use when you need to take action before proceed to continue next. It never cover the screen and always adjust center aligned as modal event. On other side, PopupWindow has flexibility to adjust information anywhere in the screen as position wise like sticky footer, sticky header, on left, right, center etc. as per location set. For Showing Information it's good option as there is facility to animate also. In short, For Showing Information with minimal action go with PopupWindow and for controlled action to proceed next go with Dialog.

Tearjerker answered 31/1, 2017 at 8:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.