j2me应用程序

发布于 2024-07-12 04:20:58 字数 65 浏览 11 评论 0原文

我正在编写一个 j2me 移动应用程序...我正在尝试在应用程序中打开移动摄像头并捕获图像..该怎么做?请尽快回复。

Im writing a j2me application for mobile...im trying to open the mobile camera in the application and capture the image..how to do it?please reply as soon as possible.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

终难愈 2024-07-19 04:20:58

如果手机支持MMAPI,你可以像这样拍摄快照。

//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
   }
}

这是一篇关于sun的旧文章点击我!

If the MMAPI is supported by the phone, you could take snapshots like this.

//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
   }
}

Here is an old article on sun click me!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文