Start own camera without displaying selection

Is it possible to launch my own application for the Android camera, which launches the camera by default, instead of showing the intention of the choice, and then starting activity to get the results?

+5
source share
3 answers

You can launch the Camera application using an intent, for example: Assigning an Android Camera

You can set a specific class in your intent as follows:
Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
intent.setClassName("com.android.camera", "com.android.camera.Camera");

This does not display the choice of intent and launches the default Camera-app.

+3
source
Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);            
 startActivityForResult(intent, TAKE_PICTURE);
0
source
imageView = (ImageView)findViewById(R.id.imageView1);
        Button photoButton = (Button)findViewById(R.id.button1);
        photoButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE);
                startActivityForResult(cameraIntent, CAMERA_REQUEST);
            }
        });
    }

    protected void onActivityResult(int requestCode, int resultCode, Intent data) { 
        if (requestCode == CAMERA_REQUEST) { 
            Bitmap photo = (Bitmap) data.getExtras().get("data");
            imageView.setImageBitmap(photo);
        } 

    } 

<uses-feature android:name="android.hardware.camera"/>
0

All Articles