开发者

J2ME how to take photo and save it to memory?

Just take photo and save. I dont need any "Showing the Camera Video" or etc. Because i can't understand anything when there is to开发者_C百科o much code.


private void startPlayer() {
   try {
         Player player = Manager.createPlayer("capture://video");
         player.realize();
         videoControl = (VideoControl)
         player.getControl("VideoControl");
         if (m_objVideoControl != null) 
         {
           form.append((Item) videoControl.initDisplayMode(
           VideoControl.USE_GUI_PRIMITIVE, null));
           player.start();
         }
       } catch (Exception ex) {
            // handle it
}

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

To store image into DB you can use RMS. here it has explained how

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜