Jayesh
Jayesh

Reputation: 3891

How to take image from camera without saving it in SDCard?

If you are using whatsapp , check that it upload profile picture by camera without saving it in SDcard, How can we implement that ?

Upvotes: 1

Views: 5268

Answers (2)

Sachin Gadagi
Sachin Gadagi

Reputation: 749

1.    whatsapp does store your image . 

Notice that when the phone is not connected to internet , it stores the it in the phone , and may be enqueue it to some kind of handler and then probably set the new profile picture as soon when connected to internet .

2. Not saving the image & transferring it somewhere else

1] Request for permission

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

</manifest ... >

2] Using Intent to take the photo & Calling your code :

    Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    startActivityForResult(takePictureIntent, ANY_ACTION_CODE);

3][Optional for you] Viewing the photo (by setting it to ImageView)

private void handleSmallCameraPhoto(Intent intent) {
    Bundle extras = intent.getExtras();
    mImageBitmap = (Bitmap) extras.get("data");
    mImageView.setImageBitmap(mImageBitmap);
}

Upvotes: 1

Alex Cohn
Alex Cohn

Reputation: 57163

If your app opens camera and calls Camera.takePicture(), it receives the captured image in Jpeg as byte array. You can do whatever you want with these bytes - write to local storage, send to the cloud.

You cannot avoid going through sdcard if you use camera capture intent.

Upvotes: 0

Related Questions