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
Highlighted
New Developer
Posts: 3
Registered: ‎04-21-2009
My Device: Not Specified
Accepted Solution

Invoke Video Camera directly

How invoke Video Camera directly without pass through Camera?

Now using :  Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA,  new CameraArguments()) application starts with Camera and

user select Video Camera from menu.

 

Thank you in advance!

New Developer
Posts: 3
Registered: ‎04-16-2009
My Device: Not Specified

Re: Invoke Video Camera directly

hello guys..

 

please let me know the workaround, 

because i know few application, which are successfully doin this.

how can i invoke a video camera from my application.......

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

Re: Invoke Video Camera directly

Within the CameraArguments you can specify CameraArgments.ARG_VIDEO_RECORDER to start the Video Recorder application.
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
Developer
Posts: 558
Registered: ‎11-25-2008
My Device: Not Specified

Re: Invoke Video Camera directly

You'll find yourself really restricted though. The JDE 4.7 API doesn't allow you access to a lot of the functionality you'd want to, such as the video LED, none of the cool camera abilities, like zoom and focus (though you can probably fake the zoom by taking a higher resolution snapshot). Unfortunately, the snapshot also is always accompanied by a sound. I'm hoping these APIs will be open up soon as I have 3 apps in the sidelines waiting for this functionality.

 

BTW, for those with an interest, I've just found a lot of J2ME code under code.google.com. You can search for javaME there. There is a project called ZXing, for example, that has full 2D barcode processing and they support J2ME also, so you can take a photo, pass it to the library and it'll process the image to give you the barcode decoding. There are many other libraries too. Most are written for Android, but many have javaME versions too.

 

Thx

-D

New Developer
Posts: 3
Registered: ‎04-21-2009
My Device: Not Specified

Re: Invoke Video Camera directly

OK,  this argument is since 4.7 but for previous versions?
Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Invoke Video Camera directly

For old versions this feature is not possible. Havn't seen any hack posted in this forum for the same.

Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 558
Registered: ‎11-25-2008
My Device: Not Specified

Re: Invoke Video Camera directly

Yes, everything stated is for 4.7 only to my knowledge.

 

Same with the limitations.

 

I think that the Storm is going to lose to the new Iphone unless they hurry up and come out with 4.8 with proper control of the camera as I'll bet the new Iphone will allow full access to their new camera which is as good if not better than the Storm's.

 

-D

New Developer
Posts: 3
Registered: ‎04-21-2009
My Device: Not Specified

Re: Invoke Video Camera directly

YES, this limitations are  not appropriate for developers.
Developer
Posts: 558
Registered: ‎11-25-2008
My Device: Not Specified

Re: Invoke Video Camera directly

No kidding. I went with the Storm so I could develop these apps and now I can't because the API isn't there. Couldn't believe it. I have to develop a different app instead.

 

-D

New Developer
Posts: 2
Registered: ‎11-26-2009
My Device: Not Specified

Re: Invoke Video Camera directly

this is a complete solution to invoke camer in ur application

 

 UiApplication.getUiApplication().addFileSystemJournalListener(this);
 Invoke.invokeApplication(Invoke.APP_TYPE_CAMERA, new CameraArguments());

 

implement  FileSystemJournalListener in your class

 

public void fileJournalChanged()
    {
         
       long lastUSN=0;
      
     
        long USN = FileSystemJournal.getNextUSN();
        for (long i = USN - 1; i >= lastUSN; --i)
        {
           FileSystemJournalEntry entry = FileSystemJournal.getEntry(i);
           if (entry != null)
           {
               if (entry.getEvent() == FileSystemJournalEntry.FILE_ADDED || entry.getEvent() == FileSystemJournalEntry.FILE_CHANGED || entry.getEvent() == FileSystemJournalEntry.FILE_RENAMED)
               {
                    if (entry.getPath().indexOf(".jpg") != -1)
                    {
                        lastUSN = USN;
                        imgpath=entry.getPath();
                        EventInjector.KeyEvent inject = new EventInjector.KeyEvent(EventInjector.KeyEvent.KEY_DOWN,Characters.ESCAPE,1, 50);
                        inject.post();
                        inject.post();
                        getImage(imgpath);
                       
                       /* UiApplication.getUiApplication().invokeLater(
                            new Runnable()
                            {
                                public void run()
                                {
                                getImage(imgpath);
                                }
           
                            }
                        );*/
                        break;
                   }  
                }
            }
        }
 }

 

private void getImage(String url)
 { 
      
       try {
            FileConnection fconn = (FileConnection)Connector.open("file://"+url);
            if (fconn.exists())
            {
               InputStream input = fconn.openInputStream();
               byte[] data = new byte[(int)fconn.fileSize()];
               input.read(data, 0, data.length);
               Bitmap b = Bitmap.createBitmapFromBytes(data, 0, -1, 5);
               label.setText("file exist");
               if(b!=null)
               {
                //   imgfield.setImage(b);
                    label.setText("secuss fully created"+url);
               }
          }
            label.setText("");
            fconn.delete();
            fconn.close();
        }
        catch (Exception e)
        {
          label.setText(" file not fond"+e.toString()+url);
        }
  }

 

ennjoy yourself