I am doing a Popup with 3 Spinners and an EditText. After reading many blogs and articles I can't decide which is the best option, PopupWindow or DialogFragment.
The criteria would be:
If there is a better way to do it I am open to change the perspective.
Thank you very much.
DialogFragment:
PopupWindow:
EDIT: CONCLUSION
DialogFragment allows you to use more complex features. Another important thing is that it is more tablet-friendly as it lets user to have opened more than one fragment at a time. Fragments are a more dynamic solution and they are the standard for newer Android versions.
PopupWindow is simpler and it is very helpful on simple questions to the user.
The support library can give you a DialogFragment
which is compatible with old versions of android. Go ahead with the fragment dialog cuz what you're asking is pretty specifical (3 spinners and an edittext. Just right click your project and press on "Android tools" --> "Add support library"
Make sure when you use the dialog to import
import android.support.v4.app.DialogFragment;
Else you'll end up using the dialog without the support :P. You will have more flexibility with the dialog fragment and the power to use the view you see fit (even a layout made by yourself) without much effort.
Dialog Fragment
Pros:
Cons:
Popup Window:
Pros:
Cons:
These are just from the top of my mind and from my experience, but you should read the documentation
http://developer.android.com/reference/android/widget/PopupWindow.html
http://developer.android.com/reference/android/app/DialogFragment.html
If you need EditText in your window and want to let your user to be able to longpress in it and paste (normal behaviour of an edit-text) then do not use popupwindow, I found it in hard way so:
A pretty Big Cons on popupwindow is that long press on edit-text wont bring default context menu (copy/paste/select all,...).also some reported in some devices this actually causes an app crash. see this https://code.google.com/p/android/issues/detail?id=62508
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With