Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera Image Capture Intent fails to return in Galaxy Tab Limited Edition

I'm having problems with a Galaxy Tab Limited Edition ( Google I/O ) when I open the camera whit an Intent.

This is my code:

Intent imageCaptureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
imageCaptureIntent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(new     
    File(mSavedFilePath)));
startActivityForResult(imageCaptureIntent, REQUEST_IMAGE_CAPTURE);

On a Motorola Xoom this code is working fine. But on Galaxy Tab 10.1, never I receive the response from the camera app.

I haven't a stack trace because i haven't an error.

Anyone have any idea?

like image 733
PipiBadenas Avatar asked Jun 14 '11 01:06

PipiBadenas


People also ask

How do you open camera through intent and display captured image?

This is done as follows: Intent camera_intent = new Intent(MediaStore. ACTION_IMAGE_CAPTURE); startActivityForResult(camera_intent, pic_id); Now use the onActivityResult() method to get the result, here is the captured image.

What is camera API in Android?

This package is the primary API for controlling device cameras. It can be used to take pictures or videos when you are building a camera application. Camera. This class is the older deprecated API for controlling device cameras.

Is there camera in tab?

As far as the cameras are concerned, the Samsung Galaxy Tab A on the rear packs 5-megapixel camera. It sports a 2-megapixel camera on the front for selfies. The Samsung Galaxy Tab A runs TouchWiz UI is based on Android 5.0 and packs 16GB of inbuilt storage that can be expanded via microSD card (up to 128GB).


1 Answers

You don't need the camera permission when launching an intent to the camera app. However this is a highly fragmented process on the android platform. i have had a lot of issues with it. basically if you check the extra file that you sent to the camera app you will notice that his size is 0 bytes when the result returns. this bug exists in a lot of android devices and thee is a workaround to fixing most of it and that is when this fails (this means there is no parceable extra output returned and if it is then the extra file is not created or with lenght 0 then you need to get the Uri from the intent like: intent.getData(); this will return an uri to the file which is basically formed the same way as the Extra Output Uri so you can afterwards use the same approach for obtaining the image.

You will notice the image is stored within the Media.Images provider and in the camera directory and ofc the intent.getData() Uri pointing in there.

Hope this helps. Don't forget to vote :D.

like image 124
DArkO Avatar answered Sep 30 '22 01:09

DArkO