Question

I want to show a DialogFragment with a DatePicker when the Spinner is clicked. I am not asking for the DialogFragment part, just for how to know when the Spinner is clicked, since you can't implement an onClick handler, only setOnItemSelectedListener (otherwise it gives you an error). Thanks in advance :)

Was it helpful?

Solution

you cant use a spinner to show a dialog, spinners show a dropdown list.

you can however make something look like a spinner that you can register an onCLick listener by changing its style

for example use a textview and set the style to

style="@android:style/Widget.Holo.Light.Spinner"

then you can set an onClick listener on the textview and show the dialog

OTHER TIPS

Why would you use a spinner for an onClick handler if you don't intend to populate it with items? I would just use a button.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top