×

Discussion Board

Results 1 to 12 of 12
  1. #1
    Registered User
    Join Date
    Oct 2010
    Posts
    15

    Post How to use Nokia Default camera?

    hi,

    I was created J2ME application for taking a snapshot and send it to server then it get stored in database. My task was completed successfully. But In the present application i am using VideoControl to show camera.
    I dont want to use VideoControl, because that videocontrol is not in fullscreen mode and I was unable to use camera softkey of the handset.

    So, I want to call the Camera and when i press Camera softkey of handset then comeback to application with raw byte data.

    Is it Possible?
    If yes, then how it possible?

    Please Help me.

    Thanks in Advance.

  2. #2
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: How to use Nokia Default camera?

    no. (you may try something with the filesystem, but i am unsure it can work)
    but you can adapt the videocontrol to be full screen ( http://java.sun.com/javame/reference...n%28boolean%29 )
    concerning the softkey, check weither you receive the event in your canvas when you press the key.

  3. #3
    Registered User
    Join Date
    Oct 2010
    Posts
    15

    Re: How to use Nokia Default camera?

    dear njzk2,
    i had used videoControl.setDisplayFullScreen(true) and also tried with canvas also.
    still that camera not in fullscreen mode.

  4. #4
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: How to use Nokia Default camera?

    Quote Originally Posted by vijju_siri143 View Post
    dear njzk2,
    i had used videoControl.setDisplayFullScreen(true) and also tried with canvas also.
    still that camera not in fullscreen mode.
    In case of Canvas, did you set the full screen mode as true?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  5. #5
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: How to use Nokia Default camera?

    what device do you tried that on?

  6. #6
    Registered User
    Join Date
    Oct 2010
    Posts
    15

    Re: How to use Nokia Default camera?

    I am Using Nokia 5233 and Nokia 3110c handsets for testing.

  7. #7
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: How to use Nokia Default camera?

    Quote Originally Posted by vijju_siri143 View Post
    I am Using Nokia 5233 and Nokia 3110c handsets for testing.
    Don't call the setFullScreenMode(true)..
    Did you test this?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  8. #8
    Registered User
    Join Date
    Oct 2010
    Posts
    15

    Re: How to use Nokia Default camera?

    In canvas mode, i am getting only canvas as full screen not a camera.

  9. #9
    Registered User
    Join Date
    Oct 2010
    Posts
    15

    Re: How to use Nokia Default camera?

    Quote Originally Posted by raj_J2ME View Post
    Don't call the setFullScreenMode(true)..
    Did you test this?
    Yes, I was Tested without fullscreenmode also.
    if i am using without fullscreenmode then camera videocontrol too small.

  10. #10
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: How to use Nokia Default camera?

    Quote Originally Posted by vijju_siri143 View Post
    In canvas mode, i am getting only canvas as full screen not a camera.
    Inside your Canvas are you using the setfullscreenmode as true?
    that is what I am saying about?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  11. #11
    Registered User
    Join Date
    Oct 2010
    Posts
    15

    Re: How to use Nokia Default camera?

    This is the my code for camera canvas.
    check and reply.


    package myApp;

    import java.io.IOException;
    import javax.microedition.lcdui.*;
    import javax.microedition.media.*;
    import javax.microedition.media.control.*;

    public class CameraCanvas extends Canvas implements CommandListener
    {
    private final CameraMIDlet midlet;
    private final Command exitCommand;
    private Command captureCommand = null;
    private Command FullCommand = null;
    private Command ExitFullCommand = null;
    private Player player = null;
    private VideoControl videoControl = null;
    private boolean active = false;
    private String message1 = null;
    private String message2 = null;

    CameraCanvas(CameraMIDlet midlet)
    {
    this.midlet = midlet;
    exitCommand = new Command("Exit", Command.EXIT, 1);
    FullCommand = new Command("Full", Command.OK, 1);
    ExitFullCommand = new Command("ExitFull", Command.OK, 1);
    addCommand(exitCommand);
    setCommandListener(this);
    try
    {
    player = Manager.createPlayer("capture://image");
    player.realize();
    videoControl = (VideoControl)player.getControl("VideoControl");
    if (videoControl != null)
    {
    videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,null);
    captureCommand = new Command("Capture", Command.SCREEN, 1);
    addCommand(captureCommand);
    addCommand(FullCommand);
    addCommand(ExitFullCommand);
    }
    else
    {
    discardPlayer();
    message1 = "Unsupported:";
    message2 = "Can'tgetvideocontrol";
    }
    }
    catch (IOException ioe)
    {
    discardPlayer();
    message1 = "IOException:";
    message2 = ioe.getMessage();
    }
    catch (MediaException me)
    {
    discardPlayer();
    message1 = "MediaException:";
    message2 = me.getMessage();

    }
    catch (SecurityException se)
    {
    discardPlayer();
    message1 = "SecurityException";
    message2 = se.getMessage();
    }
    }

    protected void paint(Graphics g)
    {
    g.setColor(0x00FFFF00);
    g.fillRect(0, 0, getWidth(), getHeight());
    if (message1 != null)
    {
    g.setColor(0x00000000);
    g.drawString(message1, 1, 1, Graphics.TOP | Graphics.LEFT);
    g.setColor(100,150,100);
    g.drawString(message2, 1, 1 + g.getFont().getHeight(), Graphics.TOP | Graphics.LEFT);
    }
    }

    synchronized void start()
    {
    if ((player != null) && !active)
    {
    try
    {
    player.start();
    videoControl.setVisible(true);
    }
    catch (MediaException me)
    {
    message1 = "Mediaexception:";
    message2 = me.getMessage();
    }
    catch (SecurityException se)
    {
    message1 = "SecurityException";
    message2 = se.getMessage();
    }
    active = true;
    }
    }

    synchronized void stop()
    {
    if ((player != null) && active)
    {
    try
    {
    videoControl.setVisible(false);
    player.stop();
    }
    catch (MediaException me)
    {
    message1 = "MediaException:";
    message2 = me.getMessage();
    }
    active = false;
    }
    }

    private void discardPlayer()
    {
    if (player != null)
    {
    player.close();
    player = null;
    }
    videoControl = null;
    }

    public void commandAction(Command c, Displayable d)
    {
    if (c == exitCommand)
    {
    midlet.cameraCanvasExit();
    }
    else if(c == captureCommand)
    {
    takeSnapshot();
    }
    else if(c == FullCommand)
    {
    try
    {
    videoControl.setDisplayFullScreen(true);
    }
    catch (MediaException ex)
    {
    ex.toString();
    }
    }
    else if(c == ExitFullCommand)
    {
    try
    {
    videoControl.setDisplayFullScreen(false);
    }
    catch (MediaException ex1)
    {
    ex1.toString();
    }
    }
    }

    public void keyPressed(int keyCode)
    {
    if (getGameAction(keyCode) == FIRE)
    {
    takeSnapshot();
    }
    }

    private void takeSnapshot()
    {
    if (player != null)
    {
    try
    {
    byte[] pngImage = videoControl.getSnapshot(null);
    midlet.cameraCanvasCaptured(pngImage);
    }
    catch (MediaException me)
    {
    message1 = "MediaException:";
    message2 = me.getMessage();
    }
    }
    }
    }

    I was tried this code. camera is not showing but when i press on capture image is capturing.
    What's a reason?

  12. #12
    Super Contributor
    Join Date
    Mar 2005
    Location
    Paris
    Posts
    814

    Re: How to use Nokia Default camera?

    this may have to do with your paint:

    g.setColor(0x00FFFF00);
    g.fillRect(0, 0, getWidth(), getHeight());

    fills the screen, so there is a good chance your videocontrol is under.
    check the code samples on the wiki there are several examples on how to capture an image.

Similar Threads

  1. Customizing a camera 's default frame
    By vicky_nits in forum Symbian User Interface
    Replies: 2
    Last Post: 2010-02-08, 09:02
  2. Video call using back camera as a default
    By mghasan in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2009-06-29, 15:22
  3. How to change default camera image in S40 5th edition?
    By asahlot in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2008-11-01, 00:37
  4. how to use default camera app
    By ws420 in forum Symbian
    Replies: 3
    Last Post: 2008-01-14, 12:07
  5. Question about default camera UI on Noika 3250.
    By stevenhotw in forum Symbian
    Replies: 0
    Last Post: 2006-07-17, 03:49

Posting Permissions

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