0

In my application, when i will click a button, it should open the camera flash for a long time like torch. This implementation is pretty easy in Android. But in BlackBerry i did not get any direct API for this. I have tried some sort of things by which i am able to on the Video and able to make the flash for few seconds. But if you check this app, they made it possible: Flashlight Free(in App World).

Here is my code:

if(field == btnTorch)
    {
        Player player;
        VideoControl _videoControl;  
        vfmScreen.delete(btnTorch);

        try {
            player = Manager.createPlayer("capture://video");
            player.realize();
            Logger.out("Torch", "player realized");

             _videoControl = (VideoControl) player.getControl("VideoControl");
             FlashControl flashControl = new FlashControl() 
             {

                public int getMode() {
                    // TODO Auto-generated method stub
                    Logger.out("Torch", "inside getmode");
                    return 0;
                }

                public int[] getSupportedModes() {
                    // TODO Auto-generated method stub
                    Logger.out("Torch", "inside getSupportedModes");
                    return null;
                }

                public boolean isFlashReady() {
                    // TODO Auto-generated method stub
                    return false;
                }

                public void setMode(int arg0) {
                    // TODO Auto-generated method stub
                    Logger.out("Torch", "inside setMode");

                }

             };

             flashControl = (FlashControl) player
                        .getControl("javax.microedition.amms.control.camera.FlashControl");

             if(flashControl!= null) {
                    Logger.out("Torch", "before Forced fully set the mode");
                        flashControl.setMode(FlashControl.FORCE);
                        Logger.out("Torch", "Forced fully set the mode");
             }

             if (_videoControl != null) 
                {
                   Field _videoField = (Field) _videoControl.initDisplayMode(
                            VideoControl.USE_GUI_PRIMITIVE,
                            "net.rim.device.api.ui.Field");
                    _videoControl.setVisible(true);
                    _videoControl.setDisplayFullScreen(true);
                    vfmScreen.add(_videoField);
                    player.start();
                    EnhancedFocusControl efc = (EnhancedFocusControl)player.getControl("net.rim.device.api.amms.control.camera.EnhancedFocusControl");
                    efc.startAutoFocus();
                    Logger.out("Torch", "player started ");

                }
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (MediaException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

So what is the possible way to make it?

Thanks,

Arindam.

Arindam Mukherjee
  • 2,155
  • 10
  • 46
  • 78
  • possible duplicate of [Turn on Flash as Light on Blackberry](http://stackoverflow.com/questions/4253927/turn-on-flash-as-light-on-blackberry) – Nate May 30 '13 at 20:54
  • i have checked that already, but i am able to make the flash for a few seconds with the video player which i am not looking. I am looking something like this: http://www.zimbio.com/Mobile+Tips/articles/mjDGC7_mseQ/TURN+BLACKBERRY+CAMARA+FLASHLIGHT+TORCH+LIGHT – Arindam Mukherjee Jun 03 '13 at 09:02
  • I understand what you want. It's the same thing that the person who asked [this duplicate question](http://stackoverflow.com/questions/4253927/turn-on-flash-as-light-on-blackberry) wanted. – Nate Jun 03 '13 at 09:15
  • I got that. But there the thread is not resolved. That means that is not the appropriate answer. Ok. I have put my code here. Hope someone helped me.. – Arindam Mukherjee Jun 03 '13 at 09:32
  • Whether or not there's an answer that works for you doesn't really matter. This question is still a duplicate of that one, and probably also [this one that was just recently asked](http://stackoverflow.com/q/15153935/119114). That question offered a bounty, and still got no answers. – Nate Jun 03 '13 at 09:40
  • But if people did not accept the answers, how can you say that is the answer? It is really not matter, whether it is working for me But if the answers are not worked for the person who asked the question,then how other will follow them. And i have also followed the same thread before starting my coding itself. So i think, it is not the answers matter, it is the correct answer matter. Like here, you are not looking on the code or something, but you are only saying it is the duplicate questions. Is it really matter whether it is duplicate or not when the previous thread is not marked as solved. – Arindam Mukherjee Jun 03 '13 at 09:50
  • I didn't say anything about the answers. I said your **question** is a duplicate of those questions, which it is. If you have a question about the way this site works, please visit [meta.stackoverflow.com](http://meta.stackexchange.com/questions/10841/how-should-duplicate-questions-be-handled). If you want to get a better answer to an old question, I recommend you offer a **bounty** for one of those questions I linked to. But, as I said, the last bounty didn't get an answer, so you risk losing your points. I'm sorry you still need a solution, but asking over and over again won't help. – Nate Jun 03 '13 at 09:56
  • I did not ask over and over here. And if people will give the answers only for the bounty, then its sad. But i have put my question here. Lets see if anyone give me the proper answer. And thanks for sharing the second link. – Arindam Mukherjee Jun 03 '13 at 10:01
  • I don't want to comment any more. If this question got answer in near future, i will make it resolve. Otherwise i will try to delete the question. Thanks. – Arindam Mukherjee Jun 03 '13 at 10:07

0 Answers0