I have a blank button on which I would like to assign a name, a color, and store a date–all when a user long-presses that button. I would appreciate some guidance please.
- Is starting with a ContextMenu the right thing to do?
- From the ContextMenu, can I invoke other popup menus
like an EditText view for the name, a date-picker for the date, and
a color-picker for the color?
Any guidance on this kind of sub-menu invokation from a context menu is appreciated. Or if I have the wrong philosophy for assigning a name, color, and date to a button, please suggest another technique.
Thank you.
For the button long click all you will need to do is this
Then to create a context menu you will need to create a menu resource.
Then in your activity override this method and inflate your context menu
This is how you capture which item was selected and act accordingly to it
Now all you do is register your button for the context menu on long press like this..
EDIT: To show a date picker just create a dialogDate picker and add
in the switch statement of the context menu..
Here is how you create a datepicker dialog
}