03-24-2009 08:16 AM
I have a Menu Item. On click of that i am taking screenshot, but i am getting the context menu also in screenshot. I want to get only the screenshot for the screen behind context menu.
Any pointers for this?
Thanks in advance,
Solved! Go to Solution.
03-25-2009 01:18 AM
03-25-2009 05:16 AM
Agree 100% with BBDeveloper.
However, if you really want to use a Menu, then you are going to have to wait till after the menu has been replaced before taking the snapshot. You could try (and I'm not saying this would work, I have not tested it) setting a flag in the menu item, and then overriding onExposed() to test the flag and take the snapshot. This assumes that onExposed is called after the screen repaint to replace the menu.
Just a thought, might work, but I would go with BBDeveloper's suggestion if you can.
03-26-2009 06:12 AM
Thanks for you replies,
I tried to have timer option also to wait for some time before taking screenshot didnt work.
Then i tried following option, it worked. I added a repaint call before taking a screenshot. Is this a right method to do it?
// Added this line before taking screenshot
I will also explore the options mentioned by you.
07-17-2009 09:22 AM
I also developed one small application in which i want to take the screen shot of the current screen. But, i am not getting anything.
Which method we have to follow
can we go for a raw image
b1 = new Bitmap(360, 480);
or can we go for a image from our file system with the dimensions equal to the blackberry simulator dimensions
b1 = Bitmap.getBitmapResource("myimg.png");
I am using the following method to take the screenshot.
and iam using the following to convert it into bytes
int argb = new int[b1.getWidth() * b1.getHeight()];
b1.getARGB(argb, 0, b1.getWidth(), 0, 0, b1.getWidth(), b1.getHeight());
// Returns a byte array containing the encoded data for this EncodedImage
byte array = integersToBytes(argb);
and using the FileConnection to save the image.
But iam not getting anything in the specified images folder which iam writing using FileConnection.
Please tell me what went wrong with this.
07-18-2009 07:25 AM
Are you getting any exception, try debugging you will be able to find out the step at which program fails. Display.screenshot works fine, returns bitmap variable, and we should be able to save that to file. And there might be issue with encoding also. Search PNGEncoder, you will get some info on forum.