Exemplo n.º 1
0
  /**
   * We have to provide this method due to "do not do network operation in command listener method"
   * restriction, which is caused by crooked midp design.
   *
   * <p>This method is called by BTImageClient after it is done with bluetooth initialization and
   * next screen is ready to appear.
   */
  void completeInitialization(boolean isBTReady) {
    // bluetooth was initialized successfully.
    if (isBTReady) {
      StringItem si = new StringItem("Ready for images search!", null);
      si.setLayout(StringItem.LAYOUT_CENTER | StringItem.LAYOUT_VCENTER);
      mainScreen.append(si);
      Display.getDisplay(parent).setCurrent(mainScreen);

      return;
    }

    // something wrong
    Alert al = new Alert("Error", "Can't initialize bluetooth", null, AlertType.ERROR);
    al.setTimeout(DemoMIDlet.ALERT_TIMEOUT);
    Display.getDisplay(parent).setCurrent(al, parent.getDisplayable());
  }