Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 323563
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:02:33+00:00 2026-05-12T09:02:33+00:00

I have a BlackBerry application that needs to take pictures from the camera and

  • 0

I have a BlackBerry application that needs to take pictures from the camera and send them to a server. In order to do this i invoke the native camera application and listen to the filesystem. Once an image is captured and saved as a new jpeg file i get notified, resume foreground control and go about my business. The problem starts occurring after the first time this cycle is completed because now when i decide to call the camera application again it is already opened, and now the user is seeing a thumbnail of the last picture that was taken and several buttons allowing him to manipulate/manage it. naturally what i want the user to see is a preview of what the camera is “seeing” before he snaps another photo as he did before.

I have thought of various ways to solve this including killing the camera app each time (I understand this cannot be done programatically?), sending CameraArguments when invoking the app (which appears to be useless), and now i was thinking a solution could be as simple generating a “Back” key event before switching back to my app which would theoretically dismiss the annoying edit screen. Could this really be done? and if not is there any other possible solution you may think of?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T09:02:33+00:00Added an answer on May 12, 2026 at 9:02 am

    A kind of hack…

    • start Camera App
    • in TimerTask check if Camera App started and if it need to be closed (some flag)
    • if yes, invoke it(so it will became active) and push ESC keypress event injection to close it

    Take a look at this:

    class Scr extends MainScreen {
        boolean killCameraApp = false;
        final String mCameraModuleName = "net_rim_bb_camera";
        final CameraArguments args = new CameraArguments();
    
        public Scr() {
            super();
    
            Timer timer = new Timer();
            timer.scheduleAtFixedRate(new TimerTask() {
                public void run() {
                    if (isCameraRunning() && killCameraApp) {
                        getApplication().invokeAndWait(callCamera);
                        getApplication().invokeAndWait(killCamera);
                    }
                }
            }, 0, 100);
        }
    
        Runnable callCamera = new Runnable() {
            public void run() {
                callCamera();
            }
    
        };
    
        Runnable killCamera = new Runnable() {
            public void run() {
                injectKey(Characters.ESCAPE);
                killCameraApp = false;
            }
        };
    
        private boolean isCameraRunning() {
            boolean result = false;
            ApplicationManager appMan = 
                    ApplicationManager.getApplicationManager();
            ApplicationDescriptor[] appDes = appMan.getVisibleApplications();
            for (int i = 0; i < appDes.length; i++) {
                result = mCameraModuleName.equalsIgnoreCase(appDes[i]
                        .getModuleName());
                if (result)
                    break;
            }
            return result;
        }
    
        private void callCamera() {
            Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, 
                    new CameraArguments());
        }
    
        private void injectKey(char key) {
            KeyEvent inject = new KeyEvent(KeyEvent.KEY_DOWN, key, 0);
            inject.post();
        }
    
        protected void makeMenu(Menu menu, int instance) {
            menu.add(new MenuItem("start camera", 0, 0) {
                public void run() {
                    callCamera();
                    killCameraApp = false;
                }
            });
            menu.add(new MenuItem("kill app", 0, 0) {
                public void run() {
                    killCameraApp = true;
                }
            });
            super.makeMenu(menu, instance);
        }
    }
    

    EDIT: Don’t forget to set permissions for device release:
    Options => Advanced Options => Applications => [Your Application] =>Edit Default permissions =>Interactions =>key stroke Injection

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working on a BlackBerry application that consumes web services from ColdFusion
i have invoked blackberry calender from my application can anyone tell me how to
I have a wcf serivce I want to consume from a j2me application (blackberry).
I have a BlackBerry app running in the background that needs to know when
I have a BlackBerry app running in the background that needs to know when
I have written a BlackBerry app that RSA encrypts a message using PKCS1FormatterEngine. This
I am trying to develop a BlackBerry application that will show data from an
I am developing a BlackBerry application that should work on OS 4.5+. I have
I have a blackberry application with lots of images that was build for pre-OS7
I have got one .jad file that is a blackberry application and I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.