android-camera-intent

Can't get image from camera with intent chooser on 4.2.2 AVD

ぐ巨炮叔叔 提交于 2019-12-06 06:03:21
问题 I'm working on a part of my application that allows a user to select an image either from camera or from gallery, using an Intent chooser. It's working fine on my 2.2.1 android phone, but when i compile it on a 4.2.2 AVD it returns a null pointer error when i use the camera, public void onClick(View View) { Intent galleryIntent = new Intent(Intent.ACTION_GET_CONTENT,null); galleryIntent.setType("image/*"); galleryIntent.setAction(Intent.ACTION_GET_CONTENT); galleryIntent.addCategory(Intent

Android Camera Intent - Out Of Memory Error and Rotation Error

梦想与她 提交于 2019-12-06 03:14:30
I'm creating an android app that utilizes the camera to take pictures and then sends them to a server based on user input. I'm currently having some problems with the camera intent. My main problems are : Getting a picture that seems to be rotated when compared to the position it was taken. When I try to fix this Rotation I get an OutOfMemoryError So mainly I need to make sure that the orientation of the picture doesn't change and that I don't get an OutOfMemoryError. Here is the function that uses the camera Intent to take the picture. private void dispatchTakePictureIntent(int actionCode) {

What data is returned when using ACTION_IMAGE_CAPTURE?

耗尽温柔 提交于 2019-12-06 00:01:21
I'm getting a bit confused from this description: The caller may pass an extra EXTRA_OUTPUT to control where this image will be written. If the EXTRA_OUTPUT is not present, then a small sized image is returned as a Bitmap object in the extra field. This is useful for applications that only need a small image. If the EXTRA_OUTPUT is present, then the full-sized image will be written to the Uri value of EXTRA_OUTPUT. With NO EXTRA_OUTPUT , it will return a "small sized image"? With EXTRA_OUTPUT , it will return a full sized image? "Is returned as a Bitmap object in the extra field"... On my

How to get video from camera Intent and save it to a directory?

百般思念 提交于 2019-12-05 18:15:30
Is it possible to have code similar to the following that does the same for video? if (resultCode == Activity.RESULT_CANCELED) { // camera mode was canceled. } else if (resultCode == Activity.RESULT_OK) { // Took a picture, use the downsized camera image provided by default Bitmap cameraPic = (Bitmap) data.getExtras().get("data"); if (cameraPic != null) { try { savePic(cameraPic); } catch (Exception e) { Log.e(DEBUG_TAG, "saveAvatar() with camera image failed.", e); } } What I am trying to do is to be able to take a video using the Camera Intent and save that video or a copy of that video to

onActivityResult getting called as soon as camera intent is sent

旧巷老猫 提交于 2019-12-05 11:42:47
I am using the camera intent to launch the camera in my app but as soon as the intent gets fired the onActivityResult gets fired and I have not even taken a picture yet. When I do take a picture, select it and return back to my activity the onActivityResult does not get called at all here is how I launch the camera PackageManager pm = getPackageManager(); if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) { Intent camera = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); File tempDir = new File(Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES),"Mobile Map"); if (

Android: Enable/Disable Camera programmatically

删除回忆录丶 提交于 2019-12-05 08:41:58
问题 I want to enable/disable camera programmatically in my application. 回答1: You cannot do this from a regular app. You can do it from a device administrator, but the user has to explicitly enable it and it is only available on ICS. Here's the reference: http://developer.android.com/guide/topics/admin/device-admin.html 回答2: The OP is asking for any ideas, I got one idea and it could possibly work even without using the API provided by ICS. for lower API version than ICS, you can Start a service

android camera and gallery not working in nexus 5

[亡魂溺海] 提交于 2019-12-05 06:09:29
问题 In my application I use camera and gallery to upload the selected image to server. it's working fine till 4.4.2, but in 4.4.4 nexus5 both camera and gallery don't work. my camera part is in a Fragment .If I try to take a photo using the camera or pick a photo using the gallery I get "please retry" message as per my code. camera action code: String path = Environment.getExternalStorageDirectory() + "/appname"; File photopath = new File(path); if (!photopath.exists()) { photopath.mkdir(); } try

Opening Camera in Portrait mode using Intent

你说的曾经没有我的故事 提交于 2019-12-05 03:21:38
I am able to open the device's Camera from my Activity using an Intent as follows: Intent cameraIntent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Uri fileUri = getOutputMediaFileUri(); cameraIntent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri); cameraIntent.putExtra("android.intent.extras.CAMERA_FACING", 1); startActivityForResult(cameraIntent, CAMERA_REQUEST); My problem is my Activity is set to Landscape mode, so when the camera is opened, it is also opened in Landscape mode - but I need to open the Camera in Portrait mode only. So please let me know how can I do this when

How to get full size picture and thumbnail from Camera in the same intent

人盡茶涼 提交于 2019-12-04 22:08:30
I've been needing to get a solution for this problem. I've already searched and tested many solutions from this community but anyone was fit for helping me. I have two activities, the first one takes a picture and sends it to another which has an ImageView to receive that (until here i'm getting problems) and a query to insert the file path in the database (the code which do this last part is well). I guess its better for the View load an Image Low Resolution as a Thumbnail. Therefore, to save into the database i wanna get the whole path from a full size picture. Whether possible the images

Implement a Take Picture + Crop or use premade Intents?

断了今生、忘了曾经 提交于 2019-12-04 20:16:44
I'm in the middle of an Android app which takes a picture, crops it and does some extra stuff. I was hoping to do my own cropping system , but the problem comes when I test in different places. Pictures appear rotated in some cases, and not correctly cropped in others (like they had an extra margin around (seeing extra space of the original picture), or so). More on that, I've considered using Intents . This would release me from the picture taking madness, the cropping, and would add an interesting "get from gallery" option, which I haven't implemented yet. Crop intent may not be in every