×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    2

    Videocamera in J2ME Polish

    Hii,I am making an application in j2me polish which uses camera.Firstly i tried a simple j2me camera code working perfect in j2me,but not working with polish giving exception Container not valid.Even I tried j2me polish snapshot screen it is working fine in polish version2.1.4 but when i updated it to 2.2.1 snapshot start throwing Null pointer Exception.
    Plz help me.How to start camera using j2me polish.Its urgent

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Videocamera in J2ME Polish

    First of all, with this little information and no code snippets this is purely guessing. You need to provide more details.

    My first suggestion is that you could try both USE_GUI_PRIMITIVE and USE_DIRECT_VIDEO in the initDisplayVideo method call and see if the other one (than what you are now using) works

    Hartti

  3. #3
    Registered User
    Join Date
    Oct 2011
    Posts
    2

    Re: Videocamera in J2ME Polish

    Thanks hartti for rply,
    private final void initCam() {
    System.out.println("player ");

    try {
    if (player != null) {
    System.out.println("player not null");
    return;
    }
    int step = 0;
    do {
    System.out.println("do cond");
    try {
    player = Manager.createPlayer(captureProtocols[step]);
    System.out.println("myplayer");
    break;
    } catch (Exception _ex) {
    step++;
    }

    } while (step < captureProtocols.length);
    System.out.println("myplayer1");

    try {
    player.realize();
    System.out.println("myplayer2");
    if (videoControl == null) {
    videoControl = (VideoControl) player.getControl("VideoControl");
    System.out.println("myplaye3");
    }
    System.out.println("myplaye3.1");
    Canvas CN =StyleSheet.currentScreen; ///this is used to get instance of class.I found this on some website.

    videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,CN);


    // Display.getDisplay(m).setCurrent((de.enough.polish.ui.Displayable) );
    System.out.println("myplaye4");
    try {
    videoControl.setDisplayFullScreen(true);


    System.out.println("myplaye5");
    } catch (MediaException mediaexception) {
    System.out.println("myplaye6");
    videoControl.setDisplayLocation(this.getWidth() - videoControl.getDisplayWidth() >> 1, this.getHeight() - videoControl.getDisplayHeight() >> 1);
    }
    } catch (IllegalArgumentException illegalargumentexception) {
    System.out.println("myplaye7"+illegalargumentexception);


    if (player.getState() == 0) {
    System.out.println("player null");
    initCam();
    }

    } catch (IllegalStateException illegalstateexception) {
    initCam();
    System.out.println("player error1");
    } catch (MediaException mediaexception1) {
    System.out.println("player error2");
    }

    player.addPlayerListener(this);
    videoControl.setVisible(true);
    player.prefetch();
    player.start();
    this.setFullScreenMode(true);
    if(player.STARTED==playerstart){
    stoppaint=true;
    System.out.println("player started....");
    // javax.microedition.lcdui.Form form = new javax.microedition.lcdui.Form("");
    //form.append((javax.microedition.lcdui.Item) videoDisp);
    //javax.microedition.lcdui.Display.getDisplay(m).setCurrent(form);
    // repaint();
    }
    System.out.println("player start");
    } catch (Exception e) {

    System.out.println("player error3"+e.toString());
    }

    }
    This is My code but when i tried this code it create sound but no videoscreen.Camera events are working but it is not creating videoscreen.I m using polish class which call this cameracanvas class,am i doing somthing wrong.

  4. #4
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Videocamera in J2ME Polish

    Did you already try to use USE_DIRECT_VIDEO instead of USE_GUI_PRIMITIVE?

    Hartti

Similar Threads

  1. Text Field Focus Problem with J2me(j2me Polish)
    By pollux.java in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2010-10-20, 06:25
  2. J2ME Polish or LWUIT or what for commercial J2ME software?
    By SebastianM in forum Mobile Java General
    Replies: 10
    Last Post: 2010-08-18, 13:04
  3. Replies: 2
    Last Post: 2009-05-21, 06:14
  4. Compiling J2ME code with J2ME polish
    By ndl911 in forum Mobile Java General
    Replies: 1
    Last Post: 2009-03-15, 17:34
  5. How to use J2ME polish code in existing J2ME app.
    By raselbd in forum Mobile Java General
    Replies: 2
    Last Post: 2008-08-26, 14:30

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×