android-camera

Android: Take picture and save picture on SD Card

孤者浪人 提交于 2019-12-24 03:40:31
问题 I want to take a picture with my phone via an application and save the image on my phone. I've tried many of the solutions proposed on the stackoverflow questions but it did not mark so I built a method that saves the file with the right name ... but the file is empty (0kb)! Here is my code public class GameActivity extends Activity implements SurfaceHolder.Callback/*,Camera.PictureCallback*/ { private Camera camera; private SurfaceView surfaceCamera; public Handler handler = new Handler();

Trying to switch camera back to front but getting exception

偶尔善良 提交于 2019-12-24 03:39:21
问题 Trying to switch camera back to front but getting exception. cant find the problem Please Check and help.. error:- 01-27 11:49:00.376: E/AndroidRuntime(30767): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.vdrecord/com.vdrecord.AndroidVideoCapture}: java.lang.NullPointerException My Code:- public class AndroidVideoCapture extends Activity{ private static final String TAG = "CameraRecorderActivity"; private Camera myCamera; private MyCameraSurfaceView

Custom Camera PictureCallback does not run if flash used on S4 devices

不想你离开。 提交于 2019-12-24 03:37:25
问题 I have written a basic custom camera which I recently changed to use the flash (where available) on the device. Once I had made the change the code ran fine as before on my HTC One Mini 2, but no longer worked on my Galaxy S4. After stepping through I found my jpeg callback is never reached on the S4, instead the raw callback is run but with a null byte[] supplied. I found this similar question: S4 Flash Problem Which seems to confirm there is an issue and solution on these devices but the

Null Pointer Exception when grabbing picture from Gallery

眉间皱痕 提交于 2019-12-24 01:37:09
问题 i have the following code, which is used to grab images (either from camera or gallery) and then display it on an ImageView: @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(resultCode == RESULT_OK) { if(requestCode == 1888) { final boolean isCamera; if(data == null) { isCamera = true; } else { final String action = data.getAction(); if(action == null) { isCamera = false; } else { isCamera = action.equals(android.provider.MediaStore.ACTION_IMAGE

How to turn off Flash light of Camera through intents in Android Programatically?

烈酒焚心 提交于 2019-12-24 00:33:12
问题 How to turn off Flash light of Camera through intents in Android Programatically? I use the below code for activating Camera application and then taking the picture and get back to my application. String packageName = takePictureIntent.resolveActivity(packageManager).getPackageName(); if (mPhotoFileUri != null) getActivity().grantUriPermission(packageName, mPhotoFileUri, Intent.FLAG_GRANT_WRITE_URI_PERMISSION); takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, mPhotoFileUri);

How to change color of Camera LED / Flashlight in Android

有些话、适合烂在心里 提交于 2019-12-24 00:07:57
问题 I'm trying to change color of Camera LED / Flashlight in Android. is their any way to achieve this ? I know we can change colors on Nexus One Track Ball. I'm trying to change Camera LED / Flashlight color in Android like that. 回答1: I'm trying to change color of Camera LED / Flashlight in Android. is their any way to achieve this ? Tape a piece of colored transparent plastic over the LED. I'm trying to change Camera LED / Flashlight color in Android like that. There is nothing in the Android

Cannot get camera preview (call camera) , HTC Thunderbolt

╄→гoц情女王★ 提交于 2019-12-23 23:35:51
问题 I am new to android app development so please any answers would be great with code examples. My problem is this, I have to develop a camera app that streams mjpeg to a server. Now I have successfully created the app for my Motorola Atrix and that works great. My problem is after I signed and exported that app and installed it on an HTC Thunderbolt for additional device testing, I found that it freezes when I try to call for the camera and the app crashes. Since then I have tried every example

Why Tensorflow object detection API uses YUV420SP to ARGB8888 conversion

廉价感情. 提交于 2019-12-23 22:23:18
问题 So I got the tensorflow object detection API running on Android and I've noticed while going through the code that before processing frames taken from the camera they're is a conversion that goes like this in the CameraActivity.java : imageConverter = new Runnable() { @Override public void run() { ImageUtils.convertYUV420SPToARGB8888(bytes, previewWidth, previewHeight, rgbBytes); } }; I tried to look it up and I only understood the difference between the two types but I couldn't figure why

Can't get camera code from Android docs to work

半世苍凉 提交于 2019-12-23 21:40:20
问题 I am using code from http://developer.android.com/training/camera/photobasics.html Code: private void dispatchTakePictureIntent() { Intent takePictureIntent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); if (takePictureIntent.resolveActivity(getActivity().getPackageManager()) != null) { File photoFile = null; try { photoFile = FileUtilities.createImageFile(); } catch (IOException ex) { // Error occurred while creating the File Toast.makeText(getActivity(),"Error!",Toast.LENGTH_SHORT).show();

MapFragment and Camera seem to interfere with each other in the same Activity

China☆狼群 提交于 2019-12-23 20:10:44
问题 I'm trying to use a MapFragment from the Google Maps Android API v2 in conjunction with a Camera preview. I need to be able to switch between the camera preview and the MapFragment, but I can’t make it work. For the Camera preview, I’ve copied the CameraPreview class from the example guide. When I want to see the Camera preview, I add an instance of the CameraPreview class to my activity using CameraPreview mPreview = new CameraPreview(this); addContentView(mPreview, new LayoutParams