×

Discussion Board

Results 1 to 7 of 7
  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    19

    Switching from Canvas to Forms

    I am working on a mobile application that captures an image then proceeds to various menus after the image is captured. I was wondering if I capture the image using a canvas, is it possible to then go to a Form with my menus on it?

    My application currently "captures" the image, then the screen says "MobileApplication wants to record an image or audio clip"
    "Is it ok to recored"

    After selecting the soft key for OK i want to switch to the form i have with my menu. However, I'm not sure how to set up the commandListener to see when the OK key is selected. Any suggestions or sample code for this?

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    2
    I want to know, and i hope to transfer these images to international server. Is anyone doing this?

  3. #3
    Registered User
    Join Date
    Jun 2005
    Posts
    12
    If the Canvas-class implements CommandListener, you're able to control the OK-buttom within the commandAction-method.

    F.example:
    Code:
    class CameraCanvas
       extends Canvas
       implements CommandListener {
     
       Command cmdOk;  
       YourMIDlet midlet;   
    
       public CameraCanvas(YourMIDlet midlet) {
          this.midlet = midlet;   
       }   
     ..
       void CommandAction(Command c, Displayable d) {
          if(c == cmdOk) {
             midlet.doSomething();
       }
    something like that...

    Have you tried to run the application on a real phone or are you just simulating on your computer? I'm currently working with a similar project, and I'm having trouble showing the Video-player on the screen on Nokia 6680. It works fine on SE k700.

  4. #4
    Registered User
    Join Date
    Jun 2005
    Posts
    19
    Yes, I have been emulating this as well as testing it on the Nokia 6620. Besides the problems with my program, I have been able to show the video player on the screen. Do you have any specific questions with what you think is wrong?

  5. #5
    Registered User
    Join Date
    Jun 2005
    Posts
    2
    I have tested it on the Nokia 3650 and it seems no problem except for the poor image quality.

  6. #6
    Registered User
    Join Date
    Jun 2005
    Posts
    12
    I'm having trouble initializing the player. It throws a MediaException with Symbian OS error -5, "the operation requested is not supported".
    It works just fine in WTK 2.2.


    Here is the code:

    Code:
    class CameraForm extends Form implements CommandListener {
    	private final MyMIDlet midlet;
    	private final Command exitCommand;
    	private Command captureCommand = null;
    	private Player player;
    	private VideoControl videoControl;
    	private boolean active=false;
    	private StringItem messageItem;
    
       public CameraForm(MyMIDlet midlet){
    		super("Camera");
    		this.midlet=midlet;
    		messageItem = new StringItem("Message","start");
    		append(messageItem);
    		exitCommand=new Command("Exit",Command.EXIT,1);
    		addCommand(exitCommand);
    		setCommandListener(this);
    		
    		//initialize camera
    		try { 
    			player = Manager.createPlayer("capture://video");
    			player.realize();
    		
    			//Grab the videoControl and set it to the current display
    			videoControl=(VideoControl)(player.getControl("VideoControl"));
    			if(videoControl != null){
    				append((Item)(videoControl.initDisplayMode(VideoControl.USE_GUI_PRIMITIVE,null)));
    				captureCommand = new Command("Capture",Command.SCREEN,1);
    				addCommand(captureCommand);
    				messageItem.setText("OK");
    			} else{
    				messageItem.setText("No video control");
    			}
    		} catch(IOException ioe){
    			messageItem.setText("IOException:"+ioe.getMessage());
    		}catch(MediaException me){
    			messageItem.setText("MediaException cameraForm(): "+me.getMessage());
    		}catch(SecurityException se){
    			messageItem.setText("Securityexception:"+se.getMessage());
    		}
    	}
    }

  7. #7
    Registered User
    Join Date
    Jun 2005
    Posts
    12
    I've also tried to use Canvas instead of Form. This works great on SE K700 , but Nokia 6680 still throws MediaException with Symbian OS error -5

    Is it possible that 6680 does not support this feature?? I cant belive it...

Posting Permissions

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