Can I Capture phone screenshot using j2me app?

1.5k views Asked by At

I am trying to develop a wireless phone projector, wherein I will be showing phone screen on projector using a projector connected PC.

I am bit confused on how to capture screenshot of any running application in j2me.

Can you help?

Just want to capture screenshot in j2me

2

There are 2 answers

0
yoninja On

I'm not really sure of what you wanted to do but if you are thinking of a way for your app to get a screenshot of its screen then what I can say is that you can and cannot do it. Why you cannot do it? Say your using a canvas in creating your screen. I think there isn't a way of converting the Canvas to an Image. The Canvas is limited to just drawing itself on the phone screen. But, like what I have said earlier, you can also create a screenshot of your app screen. What you need to have is an Image object over your Canvas. Why Image? It is because the Image object can be converted to an image file. And the image file will be your screenshot. But, of course, there should be something that dynamically creates the image source for the image object on the canvas.

Image myScreen = Image.createImage(createScreen());

A method that creates the screen:

InputStream createScreen(){
    //dynamically creates the source of the screen
}

You can have a screenshot using myScreen. The drawback here is that rendering is quite slow. This is possible but I think this is kind of difficult to implement.

0
hasanghaforian On

With this snippet code you can take a "screenshot" of the Canvases in your app:

public Image getScreenShot() {
  Image screenshot = Image.createImage(getWidth(), getHeight());
  Graphics g = screenshot.getGraphics();
  paint(g);
  return Image.createImage(screenshot);
}    

Add getScreenShot() to any canvas that you want "screenshot" of it.Then you can get it's RGB and convert to byte[] and pass it on the network.
References:
developer.nokia