• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Camera API

sehudson

Newbie
I have a button in my application that I want to use to activate the camera and take a picture. I have a Listener on the button but i'm not sure how to access the camera. I basically want to take the picture, and then return to the activity
 
Hi I got the same error as you but I have found the solution.
Maybe it's due to import wrong class. You should import android.hardware.Camera;
See if it can help.
 
Here are all of my camera methods. I am trying to put a listener on my "add image" button.

Code:
addImage.setOnClickListener(
                    new OnClickListener() {                    
                        @Override
                        public void onClick(View v) {
                            camera = Camera.open();
                            
                            camera.release();
                        }
                        

            });
          
          
          private void takePicture() {
              camera.takePicture(shutterCallback, rawCallback, jpegCallback); 
            }
             
            ShutterCallback shutterCallback = new ShutterCallback() {
              public void onShutter() {
                // TODO Do something when the shutter closes.
              }
            };

Misplaced constructor is being noted on my takePicture method
 
Back
Top Bottom