JAVA - How to capture images using LWUIt VIdeoComponent

I have tried using MediaComponent, but since it is now deprecated it wont be good moving forward. Also i was not able to get it to re-size to full screen on the form. I am trying to use VideoComponent to capture a screen shot in an S40 device. I cant find how to instantiate the VideoComponent properly for capturing an image and not playing a video.

This question and answers originated from www.stackoverflow.com
Question by (10/12/2011 3:20:07 PM)

Answer

You can use VideoComponent for capturing an image.

First, to instantiate the VideoComponent, you need to create a native peer:

VideoComponent videoComponent = VideoComponent.createVideoPeer("capture://video");
Player player = (Player) vc.getNativePeer();
player.realize();
VideoControl videoControl = (VideoControl) player.getControl("VideoControl");

To capture the image, you have to start video component and use getSnapshot of Video Control:

videoComponent.start();
videoControl.getSnapshot(null);

If you want to resize the video component to full screen you can use:

videoComponent.setFullScreen(false);

Other posibility is:

videoComponent.setPreferredH(Display.getInstance().getDisplayHeight());
videoComponent.setPreferredW(Display.getInstance().getDisplayWidth());
Answer by

Find More Answers
Related Topics  java  mobile  java-me  lwuit
Related Questions
  • How to center align a list using LWUIT

    i am having problem aligning a list items to center. plz help me. here is the code i have done. import com.sun.lwuit.Command; import com.sun.lwuit.Component; import com.sun.lwuit.Display; import …
  • how to put ad banner in j2me using lwuit?

    I want to put a advertisement banner at the bottom of the screen of my j2me application. How can i set a container fixed at a position so even if the page is scrolled that specific container will be…
  • How to avoid a lwuit application restarting after being minimized in java-me

    I've created an application with lwuit on java-me, however, each time the user receives a phone call the applications is minimized and when the user restores it, the first Form is shown again (a spl…
  • Representing tables in the LWUIT browser

    I am trying to have a horizontally scrolling table within a HTMLComponent as the tables can be wider than the width of the mobile phone and I don't want the user to have a wrapped table. I set setSc…
  • How to show dialog with searching list using LWUIT?

    I need to show the dialog with searching list while user pressing the button. How to do it with LWUIT?
  • In J2ME Using LWUIT library.How to call another Form?

    How to Call another Form? when i used form.show() method,component of another form are not display plz help me friend. example... FirstForm.java public class FirstForm extends MIDlet implements A…
  • How to take a screen capture of an lwuit app, but not in simulator

    I have an LWUIT app that has a few components that don't display correctly in the simulator. I need to take some screen captures for docs and was hoping I could do it in code (running on the handset…
  • LWUIT: Layout calculation problem

    I have a rather large application written with LWUIT. With only a few screens that have the problem. The problem: When the page loads, everything looks fine. but when you scroll you can't scro…
  • about LWUIT supported mobiles

    Hey I have built a small application using LWUIT and I want to know which mobile devices does support LWUIT framework? Can anyone help me regarding this issue and share their knowledge.
  • How to refresh the lwuit form?

    I am working in a project in which user fills a questionnaire and the answers are then submitted to the server. For simplicity I have just kept two questions per screen and after clicking on the nex…