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

Posts: 18
Registered: ‎10-30-2008
My Device: Not Specified
Accepted Solution

How to exit camera app properly

I start the camera app by doing this


Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments());

The camera app starts. I take a picture.


I am on a 9000 bold. 

It you use the camera you will find you can't close the app until you get rid of the still image that you just took.

For example
take picture

Picture then is a static view on the screen

if you press close (menu close) it does't go away. 

If you press the esc key and then press close it goes away.


now in my application I need to simulate this but I can't get it to exit 


I want to launch the app.

press the track ball to take the pic

save the pic.

Then exit.

I inject 


EventInjector.invokeEvent( new EventInjector.KeyEvent( EventInjector.KeyEvent.KEY_DOWN, Characters.ESCAPE, 10 ));


        EventInjector.invokeEvent( new EventInjector.KeyEvent( EventInjector.KeyEvent.KEY_UP, Characters.ESCAPE, 30 ));



And it exits ok

BUT... when I open the camera again (for the second time) the still image is on the screen from the last shot.

So, it didn't actually exit. The user has to press the stupid esc key and then take another picture.


Any ideas?






BlackBerry Development Advisor
Posts: 15,784
Registered: ‎07-09-2008
My Device: BlackBerry PRIV
My Carrier: Bell

Re: How to exit camera app properly

Are you testing this in the BlackBerry Simulator or on an actual BlackBerry Bold?  What version of BlackBerry handheld software are you using (found under Options, About)?  Are you injecting events for all of the actions in your list or just the escape key to exit?
Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Trusted Contributor
Posts: 176
Registered: ‎04-12-2012
My Device: Bold 9780 & Curve 8250
My Carrier: vodacom

Re: How to exit camera app properly

hi there

Please explain how MSohm's answer is your solution?

Thank you