I found the solution:

/** Note: _flashButton and _poladroidCamera are decleared  outside the
scope for this method in the same Activity class. **/

/**
     * Set's the flash icon's drawable and updates the camera
instance's settings to reflect the new flash state.
     * NOTE This method is called on an ImageButton click.
     *
     * @param drawableId
     * @param flashMode
     */
    private void setFlashIcon(int drawableId, String flashMode)
    {
 
_flashButton.setBackgroundDrawable(getResources().getDrawable(drawableId));
        _poladroidCamera.setCurrentFlashMode(flashMode);
        _poladroidCamera.surfaceChanged(null, 0, 0,0); // this is the
magic sauce
    }


Let me know if you have any questions.

On Feb 10, 3:00 pm, Joe McCann <joseph.is...@gmail.com> wrote:
> Kevin,
>
> You are spot on and I'm yet to find the right/most efficient
> solution.  I really don't want to have to do some silly hack as I
> would think there's a way (maybe with threads?) that is the most
> efficient approach.
>
> joe
>
> On Feb 10, 2:15 pm, Kevin Duffey <andjar...@gmail.com> wrote:
>
>
>
>
>
>
>
> > He's saying that calling that after the preview has been set up.. doesn't
> > seem to immediately take affect. You either have to recreate the surface to
> > change camera parameters, or use a separate activity to "pause" the current
> > camera preview activity, then when that activity closes, it causes a
> > onSurfaceChanged() call which then picks up the change. I am guessing the OP
> > wants to do something like the camera app does (at least on my original
> > droid) where you can flip some switches/buttons while the preview is running
> > and they affect how the camera works without having to recreate the preview
> > surfaceview each time a change occurs. If you can turn flash on/off, zoom,
> > auto focus on/off, etc with immediate changes that when the picture is
> > taken, are applied.
>
> > On Thu, Feb 10, 2011 at 11:42 AM, Stephen Lebed <srle...@gmail.com> wrote:
> > > Unless I dont understand the question correctly,
> > > Camera.setParameters() should do what you need.
>
> > > Hope this helps.
>
> > > Stephen Lebed
> > > Developer
> > >http://apps.mechnology.com
>
> > > On Feb 10, 9:28 am, Joe McCann <joseph.is...@gmail.com> wrote:
> > > > I'm trying to avoid having to rewrite the Android source for the
> > > > native camera app (as it is a cluster***k of code), but am curious as
> > > > to the proper, most efficient away of being able to update the Camera
> > > > Parameters AFTER the SurfaceView of the Camera has been created and
> > > > "opened".
>
> > > > For example, if you have a button that toggles the setting of On, Off,
> > > > or Auto for the Flash, this initial parameter value is set when the
> > > > Camera is initialized (let's say Auto by default, if, of course, the
> > > > device supports it).  If you want to switch it to Off, WHILE the
> > > > current view is the instance of the Camera/SurfaceView, you press the
> > > > button and it "sets" the new parameter to the camera to "OFF";
> > > > however, the CURRENT instance of the camera does not update it's
> > > > camera settings, meaning if you take the picture the Auto flash
> > > > setting is still enabled.
>
> > > > Now, if you say launch a new Activity, like a Preferences screen, and
> > > > then go back to the Camera view, the camera now has the "OFF"
> > > > setting.  This clearly has to do with the surfaceChanged() method as
> > > > it is grabbing the NEW camera parameters and updating the camera
> > > > settings to reflect that.
>
> > > > In a nutshell, I'm wondering if there is a way inside to update the
> > > > CURRENT instance of the Camera and what a preferred approach would be.
>
> > > > Thanks!
>
> > > --
> > > You received this message because you are subscribed to the Google
> > > Groups "Android Developers" group.
> > > To post to this group, send email to android-developers@googlegroups.com
> > > To unsubscribe from this group, send email to
> > > android-developers+unsubscr...@googlegroups.com
> > > For more options, visit this group at
> > >http://groups.google.com/group/android-developers?hl=en

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

Reply via email to