On Wed, May 16, 2012 at 11:22:59PM -0700, Lisa wrote:

> > C) assuming it has a flash, determine if it supports FLASH_MODE_TORCH;
> > ? ?using parameters.getSupportedFlashModes();
> 
> List<String> list = parameters.getSupportedFlashModes();

And then you cycle through the List to see of "torch" is one of the
values.  If it is, proceed.  If not, tell the user that their device
does not support being used that way, close the camera and exit.

> > D) If FLASH_MODE_TORCH is not in there, you're done. ?If it is, then
> > ? ?you need to turn it on.

> params.setFlashMode(Parameters.FLASH_MODE_ON);

I think you misunderstood....  You need to turn FLASH_MODE_TORCH on.

   params.setFlashMode(Parameters.FLASH_MODE_TORCH);

> mycam.setParameters(params);

> mycam.startPreview();

I'm not 100% sure, but I believe camera parameters have to be set AFTER
starting the preview.  I've never seen an example do otherwise.

> mycam.autoFocus(new Camera.AutoFocusCallback() {
>    @Override
>    public void onAutoFocus(boolean success, Camera camera) {
>       // TODO Auto-generated method stub
>    }
> });

Focus mode has nothing to do with the flash.  If you don't need it for
some other reason, you don't need it.

> but only illuminates a few seconds and then turns off.

That's because you misunderstood what I wrote (which I'll admit, was
not stated clearly...sorry about that).

> how could I do to keep it on
> and try to params.setFocusMode(Parameters.FOCUS_MODE_INFINITY);
> but does not work, when I run out error.
> Because only support FOCUS_MODE_AUTO and FOCUS_MODE_MACRO.

Again, focus mode has absolutely nothing to do with the flash modes.

Also, as a side note, be advised that in ANY camera, flash distance
is only a few feet[1].  If your subject is beyond that, the flash is
useless.  I've seen people using a flash at night football games, 
indoor basketball games, etc., from the upper seats (the bleachers),
totally unaware that the flash is only lighting up the people directly
in front of them.  :-)    What they SHOULD have done, of course, is use
a faster film and/or a (much) lower f-stop....

Later,
   --jim

[1] The exact definition of "a few feet" will vary depending on the type
    and intensity of the flash, but only to a certain degree.....

-- 
THE SCORE:  ME:  2  CANCER:  0
73 DE N5IAL (/4)        MiSTie #49997  < Running FreeBSD 7.0 >
[email protected] ICBM/Hurricane: 30.44406N 86.59909W

      "'Wrong' is one of those concepts that depends on witnesses."
     --Catbert:  Evil Director of Human Resources (Dilbert, 05Nov09)

Android Apps Listing at http://www.jstrack.org/barcodes.html

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to