launch native camera with camera menu

edited February 2016 in Android Mode

i'm wondering is there any method can call native camera with native menu on it my phone is sony z2,something like the picture showing.i did try with ketai camera,but it just showing the camera images without any native menu on it is that possible? cheers

camera

Answers

  • @liquid===

    sure, that's probably possible; with native android you have only to use an intent with MediaStore.INTENT_ACTION_VIDEO_CAMERA: it opens the camera app on your phone. With processing 2XX you can do that in the same way; as for 3XX i have never tried, i ll test as soon as possible...In all cases don t forget the permissions.

  • ok,thxs for the hint,will try this later on

  • @liquid===

    tested; it works with P3XX also with some little changes.

  • edited February 2016

    great,something like this?

        import android.os.Bundle; 
        import android.app.Activity; 
        import android.content.Intent; 
        import android.graphics.Bitmap; 
        import android.view.Menu; 
        import android.view.View; 
        import android.view.View.OnClickListener; 
        import android.widget.ImageView; 
    
        Intent intent;
        void setup(){
    
         intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); 
         imageMode(CENTER);
    
        }
    
        void draw(){
    
        }
    

    how convert it to PImage to draw on screen? cheers

  • edited February 2016 Answer ✓

    @liquid===

    something like this to launch the native camera, then you take your picture, then you get it from the default android pictures folder and put it on screen with standard P5 code (image(myImage, here, there);

        import android.app.Activity;
        import android.content.Intent;
        import android.net.Uri;
        import android.os.Bundle;
        import android.os.Environment;
        import android.provider.MediaStore;
        import android.view.Menu;
        import android.view.MenuItem;
        import android.view.View;
    
    
    
        public static final int LAUNCH_CAM =1;
        public static final int CAMERA_REQUEST = 2;
        //static int RESULT_OK;
    
        public void setup(){
          orientation(LANDSCAPE);
          Intent intent= new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA);
          getActivity().startActivityForResult(intent, LAUNCH_CAM);
        }
    
    
        public void onActivityResult(int requestCode, int resultCode,Intent data)
            {
              if (requestCode == CAMERA_REQUEST && resultCode == Activity.RESULT_OK){
    
                println("tout est ok------------------");
            }
          }
    
    
        public void draw(){
    
    
    
        }
    
  • @akenaton,great,that works. but the pde will sayin that getActivity() function does not exist https://github.com/processing/processing-android/issues/171 thxs for the help!

  • Answer ✓

    @liquid:: dont listen to pde... You are in a fragment since P3xx and this.getActivity() is absolutely mandatory....and it works!!!

Sign In or Register to comment.