android-camera-intent

java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1888, result=0, data=null} to activity

。_饼干妹妹 提交于 2019-11-27 03:37:16
My app allows the user to press a button, it opens the camera, they can take a photo and it will show up in an imageview. If the user presses back or cancel while the camera is open I get this force close - Failure delivering result ResultInfo{who=null, request=1888, result=0, data=null} to activity... so i am guessing the result=0 is the issue what would I need to insert to make this stop force closing? Below is my code. I know I am forgetting something but just cant figure it out! (Admittedly I am about 2 weeks into learning android development). Thanks for any help! private static final int

Android - Save images in an specific folder

有些话、适合烂在心里 提交于 2019-11-27 03:25:43
I need to save the pictures taken with my app in an specific folder. I've read many solutions to this problem but I couldn't make any of them work so I ask for help. MainActivity.java public void onClick(View v) { Intent camera = new Intent( android.provider.MediaStore.ACTION_IMAGE_CAPTURE); //Folder is already created String dirName = Environment.getExternalStorageDirectory().getPath() + "/MyAppFolder/MyApp" + n + ".png"; Uri uriSavedImage = Uri.fromFile(new File(dirName)); camera.putExtra(MediaStore.EXTRA_OUTPUT, uriSavedImage); startActivityForResult(camera, 1); n++; } AndroidManifest.xml

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

核能气质少年 提交于 2019-11-27 02:35:12
问题 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) {

how to set camera Image orientation?

三世轮回 提交于 2019-11-27 01:56:16
In my application I have added feature of image uploading,It works fine with all the Images except camera image,whenever I browse camera image from gallery and portrait image rotate in 90 degree..following is my snippet code..can anyone help me?I followed so many tutorials but all of them work well in kikat..but when same tutorial does not work with ics,jellybean etc.. public class MainActivity extends Activity { private Button browse; private String selectedImagePath=""; private ImageView img; private TextView messageText; private static int SELECT_PICTURE = 1; @Override protected void

Stop saving photos using Android native camera

主宰稳场 提交于 2019-11-27 00:52:14
I am using native Android camera and save file to my application data folder (/mnt/sdcard/Android/data/com.company.app/files/Pictures/). At the same time anther copy of photo is saved to DCIM folder. This is my code: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); String formattedImageName = getDateString() + ".jpg"; File image_file = new File(this.getExternalFilesDir(Environment.DIRECTORY_PICTURES), formattedImageName); Uri imageUri = Uri.fromFile(image_file); intent.putExtra(MediaStore.EXTRA_OUTPUT,imageUri); startActivityForResult(intent, REQUEST_FROM_CAMERA); How can I prevent

broadcast receiver won't receive camera event

天涯浪子 提交于 2019-11-27 00:03:35
I'm trying to make an app that detects when a user takes a photo. I set up a broadcast receiver class and registered it in the manifest file by: <receiver android:name="photoReceiver" > <intent-filter> <action android:name="com.android.camera.NEW_PICTURE"/> <data android:mimeType="image/*"/> </intent-filter> </receiver> No matter what I try to do the program won't receive the broadcast. Here is my receiver class: public class photoReceiver extends BroadcastReceiver { private static final String TAG = "photoReceiver"; @Override public void onReceive(Context context, Intent intent) {

onActivityResult returned from a camera, Intent null

寵の児 提交于 2019-11-26 23:13:20
问题 I follow the instruction on Camera on Android dev site I just start the Camera Intent, not build my own camera. The sample code to handle result return after taking a photo is as follows. protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == CAPTURE_IMAGE_ACTIVITY_REQUEST_CODE) { if (resultCode == RESULT_OK) { // Image captured and saved to fileUri specified in the Intent Toast.makeText(this, "Image saved to:\n" + data.getData(), Toast.LENGTH_LONG)

Camera capture orientation on samsung devices in android

两盒软妹~` 提交于 2019-11-26 22:58:21
问题 I am creating a camera app. The image when captured is shown in the grid view. Now, the code is working completely fine on all the devices except for samsung devices. I am facing the orientation issue. When I capture an image in a portrait mode, the image rotates when displayed in the gridview. I have not kept any rotate code. Secondly, with the EXIF I achieved the proper image in the grid view but when the device orientation changes, again the image rotates in a wiered fashion. Attaching

Android - Capture photo

人盡茶涼 提交于 2019-11-26 22:56:18
问题 In my application, i have to implement native camera activity where i have to launch the camera and take photo. In detail, my application containing, One TextView (at top) to display activity name and one Button (At bottom) and in Middle Area of the screen, Camera preview should be viewed..When user click on that Button, Snaps should be clicked and display it into Imageview of another activity. I know that the following approach is used: Intent intent = new Intent(android.provider.MediaStore

Android - Taking photos and saving them with a custom name to a custom destination via Intent

 ̄綄美尐妖づ 提交于 2019-11-26 22:25:39
I have a program that opens the camera via Intent to take a photo. That much part works fine already. However, I want it to save to a certain folder with a certain file name (the file name is optional but it would really really help). So here's what I have so far. Here's the line of code that opens the camera: //TODO camera stuff. Intent openCam = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); //The two lines of code below were commented out at first. //They were eventually added when I tried to save it with a custom name and destination fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE); //