2009-01-17 6 views
0

Im écrit une application j2me pour mobile ... im essayant d'ouvrir la caméra mobile dans l'application et capturer l'image .. comment faire? S'il vous plaît répondre dès que possible.j2me application

Répondre

1

Si le MMAPI est pris en charge par le téléphone, vous pouvez prendre des instantanés comme celui-ci.

//Use this method to initialize 
// m_Form is the displayed Form 
private void startPlayer() { 
    try { 
     Player m_objPlayer = Manager.createPlayer("capture://video"); 
     m_objPlayer.realize(); 
     m_objVideoControl = (VideoControl) 
     m_objPlayer.getControl("VideoControl"); 
     if (m_objVideoControl != null) 
     { 
      m_Form.append((Item) m_objVideoControl.initDisplayMode(
      VideoControl.USE_GUI_PRIMITIVE, null)); 
      m_objPlayer.start(); 
     } 
     } catch (Exception exc) { 
      // handle Exception 
} 

// Use this to take a snapshot 
public void commandAction(Command cmd, Displayable d) { 
    if ((cmd == snapShotCommand) && d == this) { 
    try { 
     data = 
      m_objVideoControl.getSnapshot("encoding=jpeg&width =160&height=120")); 
      // m_objVideoControl.getSnapshot("encoding=png&width= 80&height=60")); 
      // m_objVideoControl.getSnapshot("encoding=bmp&width= 160&height=120")); 
    } catch (Exception exc) { 
    // handle Exception 
    } 
} 

Voici un vieil article sur le soleil click me!