J2ME как сделать фото и сохранить его в памяти? - PullRequest
2 голосов
/ 08 февраля 2011

Просто сфотографируй и сохрани. Мне не нужно показывать видео с камеры и т. Д., Потому что я ничего не понимаю, когда кода слишком много.

1 Ответ

2 голосов
/ 08 февраля 2011
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
   }
}

Для сохранения изображения в БД вы можете использовать RMS. здесь он объяснил, как

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...