1. Again you will add another menu item to the
FieldSamplerScreen
class to display this form of dialog.MenuItem _ButtonChoiceDialogAction = new MenuItem("Demo Button Choice Dialog", 10000, 100) { public void run() { Object[] _choices = {"Choice1","Choice2","Choice3"}; int[] _values = {0,1,2}; int retValue = Dialog.ask("Please select a value", _choices,_values, 2); Dialog.alert("You selected "+_choices[retValue].toString()); } };
2. Also, again, you need to add the following code to display the menu item when it is shown. Add this code to the
makeMenu
method.
This code isn't quite as easy as using a common dialog, but getting the power to display your own values in the buttons being shown to the user is worth the effort. The objects in the _choices
list don't necessarily need to be a type of String
either. Much like the ObjectChoiceField
, the class will use the toString...