Example #1
0
 /** Shows the ListDemo main view. Displays a confirmation query if needed. */
 protected void back() {
   if (hasChanged() && confirmationQuery) {
     int[] tmp = new int[originalSelectedIndices.length];
     System.arraycopy(originalSelectedIndices, 0, tmp, 0, tmp.length);
     if (Dialog.show("save changes", "Save changes made?", "Yes", "No")) {
       showSelectedDialog(); // Proceed with the changes
     } else {
       setSelectedIndices(tmp); // Abandon changes
       DemoMidlet.getMainForm().show();
     }
   } else {
     DemoMidlet.getMainForm().show();
   }
 }
Example #2
0
  /** Shows a Dialog displaying the selected indices and then shows the MIDlet main view. */
  public void showSelectedDialog() {
    String text = (getSelectedIndices().length == 0 ? "No selected items." : "");
    for (int i = 0; i < getSelectedIndices().length; i++) {
      text += "List item " + (getSelectedIndices()[i] + 1) + " selected.\n";
    }

    Dialog.show(
        Compatibility.toLowerCaseIfFT("Selected"),
        text,
        new Command(Compatibility.toUpperCaseIfFT("Continue")),
        null,
        Dialog.TYPE_INFO,
        null,
        1500L);

    DemoMidlet.getMainForm().show();
  }