Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make camera appear in particular screen area in android?

Tags:

android

camera

I need camera to appear in particular screen area in android here is the code that I use for camera activity

Now camera is working but it occupies whole screen I want camera to appear in particulat area of screen how to do this??

 private void uploadPhoto(String name) {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        File file = new File(Environment.getExternalStorageDirectory(), name
                + ".jpg");
        mImageCaptureUri = Uri.fromFile(file);
        try {
            intent.putExtra(android.provider.MediaStore.EXTRA_OUTPUT,
                    mImageCaptureUri);
            intent.putExtra("return-data", true);
            startActivityForResult(intent, PICK_FROM_CAMERA);
        } catch (Exception e) {
            e.printStackTrace();
        }

    }
like image 819
Sourabh Saldi Avatar asked Oct 04 '12 05:10

Sourabh Saldi


People also ask

How do I change Camera permissions on Android?

On your phone, open the Settings app. Tap Privacy. Turn off Camera access or Microphone access.

How do I access Camera on Android?

Tap the app drawer icon. It's the icon made of 6 to 9 small dots or squares at the bottom of the home screen. This opens the list of apps on your Android. If you see the Camera app on the home screen, you don't have to open the app drawer. Just tap Camera or the icon that looks like a camera.


2 Answers

You cannot use an intent for this. If you use an intent, it wil launch the camera app. Instead, you need to use something called a Camera Preview. This will show what the camera sees to the user and you can then use API's to control the camera actions.

here is a very nice tutorial for this from the official developer docs: https://developer.android.com/guide/topics/media/camera.html#custom-camera

like image 112
Anup Cowkur Avatar answered Oct 13 '22 01:10

Anup Cowkur


You are opening the default camera app when you are using the camera intent. But if you need to display camera in a particular part of the screen you should consider making your own camera application. Read here for more http://developer.android.com/guide/topics/media/camera.html

like image 27
Dinesh Venkata Avatar answered Oct 13 '22 00:10

Dinesh Venkata