Beispiel #1
0
 private void handleException(Exception e) {
   Alert a = new Alert("Exception", e.toString(), null, null);
   a.setTimeout(Alert.FOREVER);
   // Throw with a proper JR alert. Crash for now until someone fixes this.
   // mDisplay.setCurrent(a, mMainForm);
   throw new RuntimeException(
       "Snapper MIDLlet exception needs to be displayed as an alert, but fixed to use j2me properly");
 }
    public void run() {
      try {
        //				byte [] snap = videoControl.getSnapshot("encoding=jpeg&width=160&height=120");
        byte[] snap = videoControl.getSnapshot("encoding=jpeg");
        if (snap != null) {
          Image im = Image.createImage(snap, 0, snap.length);
          int a = im.getHeight();
          int b = im.getWidth();

          System.out.println("my height is " + a);
          System.out.println("My width is " + b);
          Alert al = new Alert("MyImage", "My dimensions are:" + b + "," + a, im, AlertType.INFO);
          al.setTimeout(2000);
          parentMidlet.getDisplay().setCurrent(al, aVideoCanvas);
        }
      } catch (MediaException me) {
        System.err.println(me);
      }
    }