Beispiel #1
0
  public static boolean checBTAPISupport() {
    // jpgsupport = false;
    try {
      Class c = null;
      c = Class.forName("javax.bluetooth.DiscoveryAgent");
      if (c != null) c = Class.forName("javax.bluetooth.LocalDevice");

      if (c == null) return false;
    } catch (Exception e) {
      return false;
    }

    return true;
  }
  /**
   * Retrieves the classname for a given MIDlet name.
   *
   * <p>
   *
   * @param midletName the name of the MIDlet to find
   * @return the classname of the MIDlet. <code>null</code> if the MIDlet cannot be found
   */
  protected String getMIDletClassName(String midletName) {
    String midlet;
    MIDletInfo midletInfo;

    for (int i = 1; ; i++) {
      midlet = getProperty("MIDlet-" + i);
      if (midlet == null) {
        /*
         * If the name was a class name use it.
         * (Temporary implemention - overloading the
         * name as MIDlet name or class name could be in
         * conflict. Longer term solution would expand
         * Installer.execute() semantics to allow a class
         * name to run, rather than just the indirection
         * via MIDlet info.)
         */
        try {
          Class.forName(midletName);
          return midletName;
        } catch (Exception e) {
        }

        return null; // We went past the last MIDlet
      }

      midletInfo = new MIDletInfo(midlet);
      if (midletInfo.name.equals(midletName)) {
        return midletInfo.classname;
      }
    }
  }