android-camera-intent

Image loses it's original result when passing it to another activity

杀马特。学长 韩版系。学妹 提交于 2019-11-27 09:50:25
I am working on a camera feature in my application. I am capturing an image and passing it to another activity. The problem that I'm facing is when I display the image in another activity it loses its original result (gets pixilated) for some reason. This is how I'm doing it: private void takePhotoFromCamera() { if(ActivityCompat.checkSelfPermission(EnterDataView.this, Manifest.permission.CAMERA) == PackageManager.PERMISSION_GRANTED){ Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_REQUEST); }else { String[]

Picture taken with camera intent is low quality on ImageView (7.0+)

孤街浪徒 提交于 2019-11-27 09:50:10
I know there are lots of examples of this, but I haven't found a solid example that works with 7.0+. I know that I am setting the thumbnail of the image rather than the original, but I am not sure how to get it. Here is my code: if( ContextCompat.checkSelfPermission(this, android.Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { requestPermissions(new String[]{android.Manifest.permission.CAMERA}, CAMERA_REQUEST_CODE); } }else{ Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent

Null URI on API level >=23 camera intent [duplicate]

两盒软妹~` 提交于 2019-11-27 09:03:20
问题 This question already has an answer here: What is a NullPointerException, and how do I fix it? 12 answers This might be a possible duplicate but i can't seem to pinpoint the exact solution. Camera works fine and returns the image uri on devices below api 23. However app crushes right after capturing image on devices apove api 23 with log error java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=2, result=-1, data=Intent { act=inline-data (has extras) }} to

How to distinguish whether the image is coming from gallery or camera in android?

只谈情不闲聊 提交于 2019-11-27 08:45:26
问题 I am making an app in which i can pick an image from gallery or i can take image from camera and i am moving to next activity with the selected image.There I want to distinguish whether the image is coming from gallery or camera.I am not getting any idea how to do it.I am providing my code.Please help me how to do this. My first activity is import java.io.ByteArrayOutputStream; import android.app.Activity; import android.content.Intent; import android.database.Cursor; import android.graphics

Android camera photo comes back null

烂漫一生 提交于 2019-11-27 08:45:16
问题 In my android app I employ a camera activity which sometimes works and sometimes doesn't. About 30% of the time the uri set up to store the photo comes back with a null value even though the camera picture is stored in the picture directory on the phone. Below is my start activity. Uri imageUri; // These are defined at the global level Uri selectedImage; ............... String fileName = name.replace(" ", ""); fileName = fileName + suffix + ".jpg"; ContentValues values = new ContentValues();

Trouble working with the camera in onActivityResult

故事扮演 提交于 2019-11-27 08:43:39
I have two options "select photo" and "take photo" - I have my select photo functionality fully working, but having problems with taking a photo. Mainly having the saved image display in my image view, after its been saved. Defined my photo location: public class photoActivity extends Activity { private String photoPath; private ImageView imgView; {...} My camera listener: bPicFromCam.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { String state = Environment.getExternalStorageState(); if (Environment.MEDIA_MOUNTED.equals(state)) { long captureTime = System

Android: App crashes on onActivityResult while using Camera Intent

。_饼干妹妹 提交于 2019-11-27 07:35:25
问题 I am using camera intent to capture images in my App. The problem my app crashes on Android 5.0.2 while using camera. I am using intent from fragment. Below is my code inside fragment: Method to take photo private void takePhoto() { mHighQualityImageUri = Util.generateTimeStampPhotoFileUri(getActivity()); Log.d(UploadPicturesFragment.class.getSimpleName(), "URI: " + mHighQualityImageUri.toString()); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA

android camera : Failure delivering result ResultInfo{who=null, request=0, result=-1, data=null} to activity

对着背影说爱祢 提交于 2019-11-27 04:13:30
i've really frustased to solve my problem, i have an application that using camera, when camera capture a photo, it will display on activity, when i'm not using cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, mPhotoUri); photo will display on activity, but the name and path file is not like what i wanted. i'm using galaxy tab for compiling it, i have follow tutorial to solve my problem from here , here and here but my application still force close and eror, this is my code : { File sdCard= Environment.getExternalStorageDirectory(); File path = new File (sdCard.getAbsolutePath() + "/android/data

Android: BroadcastReceiver intent to Detect Camera Photo Taken?

﹥>﹥吖頭↗ 提交于 2019-11-27 04:08:06
I'm working on an Android application which needs to perform an action each time a new image is taken with the phone. I don't want to take the image within my application, but rather perform some action when the Camera app takes an image and saves it to the SD card. Right now, I've gotten a BroadcastReceiver implemented that's currently listening for "android.intent.action.CAMERA_BUTTON". However, this doesn't seem to get called when I'm wanting it to. I've tried to debug the application on my own phone with a linebreak on the first line of the BroadcastReceiver's OnReceive method, but it

Activity killed / onCreate called after taking picture via intent

你离开我真会死。 提交于 2019-11-27 03:39:42
I am trying to take a picture using an intent. My problem is that sometimes after taking a picture my activity, which calls startActivityForResult, seems to be destroyed so that onCreate is called again. Here is my code for taking pictures after clicking an imageview, which image should be replaced: if (!getPackageManager().hasSystemFeature( PackageManager.FEATURE_CAMERA)) { Util.makeLongToast(R.string.lang_no_camera); } else { Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(intent, TAKE_ITEM_PHOTO); } ... @Override protected void onActivityResult(int