Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code>public class MyScreen extends MainScreen{ private int currentValue = 0; String result; // Declare the result public MyScreen() { LabelField lblField = new LabelField(); lblField.setText("Current Value = " + currentValue); ButtonField btnPopup = new ButtonField("Show Popup"); btnPopup.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { UiApplication.getUiApplication().pushScreen(new MyPopupScreen()); } }); ButtonField btnGetResult = new ButtonField("result"); //Add new Button btnGetResult.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { Dialog.inform(result); } }); add(lblField); add(btnPopup); add(btnGetResult);// Add button to get the selected index } public class MyPopupScreen extends PopupScreen implements FieldChangeListener { private int currentValue = -1; RadioButtonField radio; public MyPopupScreen() { super(new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL|VerticalFieldManager.VERTICAL_SCROLLBAR), Field.FOCUSABLE ); add(new LabelField("Select Chart Type")); final RadioButtonGroup radioGroup = new RadioButtonGroup(); for (int i = 0; i &lt; 10; i++) { radio = new RadioButtonField("Option no. " + i, radioGroup, false); radio.setChangeListener(this); add(radio); } ButtonField cancelBtn = new ButtonField("Close"); ButtonField okBtn = new ButtonField("OK"); add(okBtn); add(cancelBtn); cancelBtn.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { UiApplication.getUiApplication().popScreen(MyPopupScreen.this); } }); okBtn.setChangeListener(new FieldChangeListener() { public void fieldChanged(Field field, int context) { result = radioGroup.getSelectedIndex()+""; UiApplication.getUiApplication().popScreen(MyPopupScreen.this); } }); } public void fieldChanged(Field field, int context) { if (field instanceof RadioButtonField) { RadioButtonField radio = (RadioButtonField) field; currentValue = radio.getIndex(); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload