I see a ton of results when searching for how to open the camera, and get the returned image. What about simply opening the camera app without any return at all? I just want the camera to function as normal.
+2
A:
You could just send an ACTION_CAMERA_BUTTON intent? That should do the trick.
Intent intent = new Intent(ACTION_CAMERA_BUTTON, null);
startActivity(intent);
Obviously, "this" needs to be your current activity.
EboMike
2010-10-06 23:39:24
beat me too it while I was looking up the action, well played good sir.
schwiz
2010-10-06 23:41:02
Next time, schwiz, next time :)
EboMike
2010-10-06 23:42:22
How do I send an intent?
Joren
2010-10-06 23:42:51
Added code sample.
EboMike
2010-10-06 23:45:49
I used this and it worked.Intent i = new Intent(Intent.ACTION_CAMERA_BUTTON);sendBroadcast(i);
Joren
2010-10-06 23:47:27
If it worked, then please accept the answer. Thanks!
EboMike
2010-10-07 00:02:42
@Joren: Bear in mind that other applications might intercept that button press, so there is no guarantee that this will open the camera application.
CommonsWare
2010-10-07 00:30:36
Hmm. What if the phone has no camera button? Is there a more direct way to launch the camera application.
Joren
2010-10-07 00:42:06
Different manufacturers might add their own camera apps, so I'm not sure there is "the camera app". You could launch Google's camera app directly, but some phones might replace that with their own custom app that has its own intent. Maybe there's a better way to get the "standard" camera app, but there's none that I'm aware of.
EboMike
2010-10-07 00:52:51