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

Native Development

Posts: 587
Registered: ‎04-01-2009
My Device: Z10, PlayBook
My Carrier: NA
Accepted Solution

How to modify the Gesture sample application to load a different picture after initial load

The "Gesture" sample app is a good start for me, since I want to load and display an image full screen.


However, my app needs to change the image that is being displayed later on.


I have been successful at loading the new JPEG image via:



io_stream_t* memory_stream = io_open(IO_MEM, IO_READ, num_jpeg_bytes, jpeg_bytes);

rc = img_load(ilib, memory_stream, &callouts, &img);



... but the new image isn't displayed on the screen.  I'm assuming this is because the decode_setup function that is used to load the image on initial load doesn't work for subsequently changing the image, but I'm not sure how it needs to be changed.


I've read:




... but it doesn't seem to tell me anything more than I already know.


I suppose the question is this: If you load an image into an img_t structure, how do you then take that img_t and update the screen to display that image full screen?




Posts: 1
Registered: ‎10-26-2011
My Device: Torch 9810
My Carrier: Rogers

Re: How to modify the Gesture sample application to load a different picture after initial load

Hi Daniel,


The decode_setup callout provided should successfully load any subsequential images into the render buffer. However this alone will not display the image on the screen. You will need to call screen_post_window() after your call to img_load to make your changes to the render buffer visible.




for more information, or the main() function of the Gestures sample for an example.