Some questions about access Android native camera, 50% finished

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Kevin
:warning: Old Version Published before Godot 3 was released.

Hello guys,
A few days ago, I want to call Android native camera in my project, but can’t find any tutorial, so I decided to try to solve this problem.
Step 1. Create a Activity which can access the front camera and take picture.
Step 2. Create a Singleton(extends Godot.SingletonBase), which have a method “open”, and it can start the new Activity.

Here are the screenshots

But the new questions appeared:
Q1: When the camera take a picture, and saved it, how can I accesse in GDScript ?
Q2: When the camera take a picture, and finished the activity, how to notify GDScript, may be a calback function ?

Java Code

   public void open() {
    Intent intent = new Intent();
    intent.setClass(activity, CameraCallActivity.class);
    activity.startActivityForResult(intent, CAMERA_REQUEST_CODE);

protected void onMainActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == CAMERA_REQUEST_CODE) {
        if (resultCode == Activity.RESULT_OK) {
            toast("Take Picture Success");
            // TODO need to notify
        else {
            toast("Take Picture Cancel");

GDScript Code

func _on_open_camera_pressed():
   if not Globals.has_singleton("CameraSingleton"):

   var single = Globals.get_singleton("CameraSingleton")
   #need to get the picture as a head image

Did you get any further result?

Allan Daemon | 2018-02-02 15:04

Help needed. Were you successful in trying to store and access the pictures from the camera?

viswas163 | 2018-10-02 21:30

I have the same problem :c

AJV | 2020-07-02 21:22

:bust_in_silhouette: Reply From: jospic

I’m no java developer expert, but I think you should integrate your code with something like: