is it possible to programmatically call the capture button on a camera intent from its calling activity

StackOverflow https://stackoverflow.com/questions/23567043

  •  19-07-2023
  •  | 
  •  

Pergunta

I am using some voice recognition on my activity. I have it set to open the camera intent using voice commands, but I'd also like to be able to have it snap the picture via voice. I know I could write this up using the camera object, but I'd rather keep using the intent because it offers more bells and whistles when not using voice.

I'm pretty sure this isn't possible but I'd love to be wrong here. Is there a way to call the capture button on the camera intent programmatically so I can leverage the voice commands to capture my image ie...if I say "take picture"...bam, picture is taken.

Ultimately, I'd also need to be able to programmatically hit the "confirm" button on the intent after the image is captured (or the cancel button), and then have it return to my calling activity.

Foi útil?

Solução

It is not possible. You can't control other apps. The Intent is just a messages/event. When your app sends some Intent other app could receive it and decide what to do.

I think that the only way is to implement your own camera. By the way there are lots of open-source camera apps. For instance: https://github.com/CyanogenMod/android_packages_apps_Camera.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top