Ok,
I am trying to write an app that will only run if the phone has a
camera flash (i.e. not on my HTC Hero but on a HTC EVO 4G or Samsung
Epic 4G, etc...). I found a code sample that will set the flash mode
(and should work) but after modifying it to get the flash mode I am
told that no phone has a flash when I run it even if they do. My code
is as follows, I'd appreciate any help on figuring out what I did
wrong since it looks correct to me.
final Camera mCamera = Camera.open();
final Camera.Parameters params = mCamera.getParameters();
Method methodGetFlashMode = null;
Class<?>[] methodGetFlashModeSignature = new Class[] {
String.class
};
try {
methodGetFlashMode =
params.getClass().getMethod("getFlashMode",
methodGetFlashModeSignature);
}
catch (NoSuchMethodException nsme) {
}
if (methodGetFlashMode == null) {
AlertDialog alertDialog = new
AlertDialog.Builder(this).create();
alertDialog.setTitle("Error");
alertDialog.setMessage("You do not have a flash");
alertDialog.setButton("OK", new
DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which)
{
mCamera.release();
finish();
} });
alertDialog.show();
};
--
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