If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Trusted Contributor
vijaytabhatt
Posts: 146
Registered: ‎03-22-2010
My Device: Not Specified

Display.screenshot() attachment shows blank image

Hello,

All what i am doing is taking device screenshot and sending it as an attachment in email.

but the problem is that the image that comes in attachment is blank.There is no exception in the code.

I have tested it on OS 5.0 and device 8520.This issue comes on device.

here is my code,

 

Display.screenshot(email_bitmap,0,0,Display.getWidth(), Display.getHeight());
PNGEncodedImage image =PNGEncodedImage.encode(email_bitmap);

byte[] by=image.getData();

//create multipart image
Multipart multipart = new Multipart();
//add attachment
  SupportedAttachmentPart attach = new SupportedAttachmentPart(multipart, "image/jpeg",""+title+".jpg",by);
multipart.addBodyPart(attach);
  //create new message and invoke mail application
 Message msg = new Message();
 msg.setContent(multipart);

Invoke.invokeApplication(Invoke.APP_TYPE_MESSAGES,new MessageArguments(msg));

 

I have tried with both png and jpeg images.

pls help

Please use plain text.
Trusted Contributor
vijaytabhatt
Posts: 146
Registered: ‎03-22-2010
My Device: Not Specified

Re: Display.screenshot() attachment shows blank image

anyone facing same issue?

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display.screenshot() attachment shows blank image

Have you tried displaying it on the device to see if in fact the Bitmap is 'empty'

 

Have you set the permissions correctly so that you can capture screen shots?

Please use plain text.
Trusted Contributor
vijaytabhatt
Posts: 146
Registered: ‎03-22-2010
My Device: Not Specified

Re: Display.screenshot() attachment shows blank image

no i dont think that bitmap is empty ,it works on simulator and are you taking about permission on device?

i have set that.

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display.screenshot() attachment shows blank image

"no I don't think that bitmap is empty"

 

I important word here is think.  I suggest that you would be best 'knowing'.

 

The argument that it works on the Simulator holds for the entire chain of events that gets your screen shot down.  Somewhere it is breaking on the device.  You can display the results at each stage and figure out where.  Displaying the results of the screen capture is the obvious place to start isn't it?

Please use plain text.
Trusted Contributor
vijaytabhatt
Posts: 146
Registered: ‎03-22-2010
My Device: Not Specified

Re: Display.screenshot() attachment shows blank image

hi peter debugged the code but there is no exception also display.screenshot returns me non-empty bitmap.

the size of this bitmap is 3kb and it varies according to area painted on the screen.

but when we open the image it is empty.

any comments?

Please use plain text.
Developer
peter_strange
Posts: 19,601
Registered: ‎07-14-2008
My Device: Not Specified

Re: Display.screenshot() attachment shows blank image

Just what to clarify that this demonstrates that the problem is in the screen capture and not in the subsequent encoding and sending.  Can you confirm this please?

 

The only time I have seen this is when permissions were not set.  from memory, I did get a security exception message, but then the screenshot also completed but was empty, and I think all subsequent ones were empty also.  But this is from memory.  I'm not convinced I got an Exception, though getting an Exception would seem the right thing to do.

 

I would:

a) Delete the application, restart and then re-install and retry, in the hope that this clears the permissions.

b) Create a simple screen capture program and install it on the device to test with a different program.

 

Sorry I can't be more helpful. 

Please use plain text.
bog
Contributor
bog
Posts: 35
Registered: ‎05-11-2011
My Device: 9800
My Carrier: bell

Re: Display.screenshot() attachment shows blank image

did you figure out the problem? I am facing the same problem now.

Please use plain text.
New Contributor
Tornado01
Posts: 5
Registered: ‎09-07-2011
My Device: Blackberry Bold 9700
My Carrier: Telekom

Re: Display.screenshot() attachment shows blank image

Hello,

 

I have the same problem with different devices.

 

9790 (OS 7): ok

9810 (OS 7): ok

9800 (OS 6): only the first screenshot is empty

Bold 9000 (OS 5) device one: only the first screenshot is empty

Bold 9000 (OS 5) device two: screenshot is always empty

Bold 9700 (OS 6) device one: only the first screenshot is empty

Bold 9700 (OS 6) device two: screenshot is always empty

 

 

pls help

Please use plain text.