android-camera-intent

Android get full size image from camera

被刻印的时光 ゝ 提交于 2019-11-29 00:43:09
I am developing an Android App which uploads an image from the camera or from the device photo gallery to remote site. The latter I have working fine, I can select and upload. However, I am have trouble taking a full size image and uploading. This is my code: // From onCreate Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); startActivityForResult(cameraIntent, CAMERA_PIC_REQUEST); I have a method to handle the Activity result. This both handles selecting from the gallery and from the camera: public void onActivityResult(int requestCode, int resultCode, Intent

android camera portrait orientation

瘦欲@ 提交于 2019-11-28 21:53:36
I am using camera in my app. I am just using intent to start camera Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri); startActivityForResult(cameraIntent, 101); The captured image automatically comes in landscape view . How do i make camera to capture images in portrait view anujprashar If device has v2.2 or above you can rotate camera orientation to portrait using camera.setDisplayOrientation(90) . In devices below to v2.2 the camera will only display in landscape orientation and thus image will

set orientation of android camera started with intent ACTION_IMAGE_CAPTURE [duplicate]

≡放荡痞女 提交于 2019-11-28 18:25:09
This question already has an answer here: Why does an image captured using camera intent gets rotated on some devices on Android? 18 answers I'm working at an application in android which uses camera to take photos.For starting the camera I'm using an intent ACTION_IMAGE_CAPTURE like this: Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File image=new File(Environment.getExternalStorageDirectory(),"PhotoContest.jpg"); camera.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(image)); imageUri=Uri.fromFile(image); startActivityForResult(camera,1); public void onActivityResult(int

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

℡╲_俬逩灬. 提交于 2019-11-28 14:50:52
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 activity {ana.foodi/ana.foodi.MainActivity}: java.lang.NullPointerException: uri at android.app

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

[亡魂溺海] 提交于 2019-11-28 14:42:33
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.Bitmap; import android.graphics.Color; import android.net.Uri; import android.os.Bundle; import android

Android: App crashes on onActivityResult while using Camera Intent

别来无恙 提交于 2019-11-28 13:17:27
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_OUTPUT, mHighQualityImageUri); startActivityForResult(intent, REQUEST_IMAGE_CAPTURE); }

Null pointer Exception on file- URI?

假如想象 提交于 2019-11-28 12:23:55
In my app a capture button is there to capture an image using device camera,so I have used a method captureImage() on the click event of that button.When I click the button a null pointer exception is thrown.I could not understand how this happens Can anyone help? Thanks in advance! capture button on on Create () method 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);*/ captureImage(); } }); captureImage(

Taking picture with camera intent rotate picture in portrait mode android

亡梦爱人 提交于 2019-11-28 09:17:17
问题 Picture was taken successfully with camera but in portrait mode on samsung galaxy s3 the picture gets rotated. How can i solve this issue. Camera intent is as follows: Intent intent = new Intent("android.media.action.IMAGE_CAPTURE"); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(xdestination)); startActivityForResult(intent, CAMERA_PIC_REQUEST); In activity for result if (requestCode==CAMERA_PIC_REQUEST){ // Bitmap bm = (Bitmap) data.getExtras().get("data"); Uri photo_uri = Uri

How to move image captured with the phone camera from one activity to an image view in another activity?

风格不统一 提交于 2019-11-28 09:15:42
问题 The first activity has a button which when clicked, opens the inbuilt camera. Now when the picture is taken, a new activity opens with the image captured in an imageView and a share button in the next activity. I have set up the activity to open after the image is taken, however I am unable to transfer image captured across activities. Please i need help or a nudge in the right direction. The first activity which takes the picture is Takepicture.java : import android.app.Activity; import

android reduce file size for camera captured image to be less than 500 kb

主宰稳场 提交于 2019-11-28 09:01:15
My requirement is to upload camera captured image to the server, but it should be less than 500 KB. In case, if it is greater than 500 KB, it needs to be reduced to the size less than 500 KB (but somewhat closer to it) For this, I am using the following code - @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { try { super.onActivityResult(requestCode, resultCode, data); if (resultCode == getActivity().RESULT_OK) { if (requestCode == REQUEST_CODE_CAMERA) { try { photo = MediaStore.Images.Media.getBitmap( ctx.getContentResolver(), capturedImageUri); String