Recently, the project has done, call the camera to take pictures to get the function.Use the previous code directly and find that there is a problem with Android7.0.After Android6.0, dynamic application permissions have become the norm.Call camera to take pictures of this feature, you need to dynamically request camera permissions, SD card read and Write permissi
(a) Call camera to save to the specified folder, Intent.putextra (file) to save the captured photos directly to the folderHowever, this method can not be used to shoot video, the same in the camera, if the path is passed, the screen card will be dead, while the incoming path will have an empty file, the file name is correct, but no data, and in the callback function Onactivityresult data is not empty, The p
( System.currenttimemillis ()) + ". jpg"); cameraintent.putextra ( Android.provider.mediastore.extra_output,muri); cameraintent.putextra (" Return-data ", true); sTartactivityforresult (cameraintent,1);} /*** gets the data returned by the camera */privatevoidgetimgfromcamera () { ContentResolvercr= This.getcontentresolver (); try{if (camerabitmap!=null) Camerabitmap.recycle ();// if not released, keep taking pictures, will not have enough memory
Android call camera, you can write an activity, assign the relevant parameters, open the front camera can be;To apply for the permission, add in Androidmanifest.xml: Main function, open front cameraPrivate Camera Openfrontfacingcameragingerbread () { int cameracount = 0;
; Compensate The Mirror} else {//back-facing result = (info.orientation-degrees + 360)% 360; } camera.setdisplayorientation (Result); }The method of dynamic acquisition is landscape (horizontal screen) or portrait (vertical screen) to change the preview map.(The cameraid of the rear screen is 0)2. The correct angle of image preservation (when we take the photo, we find that the angle is not correct)@Overridepublic void Onpicturetaken (byte[] data, came
Recently the boss to a task, said to be in the local video terminal can adjust the camera focal length.
Encountered a number of problems:
1. Phone support does not support camera zoom
2. System with camera software can zoom, but its own programming does not support the zoom,
This problem is also a lot of children's shoes on the internet encountered:
Cop
Android multimedia calls the camera and selects an image from the local albumOverview:
The function of this routine is to take photos, automatically compress images, and select images from the local album.Permission to be loaded:
Demo:
Public class MainActivity extends Activity implements View. onClickListener {private Button mButtonTakePhoto; private Button mButtonGetPhoto; private ImageView mImageViewP
Android multimedia calls the camera and selects an image from the local album,Overview:
The function of this routine is to take photos, automatically compress images, and select images from the local album.Permission to be loaded:
Demo:
Public class MainActivity extends Activity implements View. onClickListener {private Button mButtonTakePhoto; private Button mButtonGetPhoto; private ImageView mImageViewPho
Since basically all Android phones support images with a ratio of 4:3 and 16:9, sometimes the custom Surfaceview size does not meet these two proportions and will deform.Another situation is that the default previewsize and the ratio of our view will also cause deformation; the solution is from params.getsupportedpreviewsizes () Choose the appropriate proportions and then params.setpreviewsize (), at which point the size of the preview is set, and the
WebView under the pit odd, directly under the browser can directly bring up the camera and file management, but in WebView below is not, in the online review of a lot of articles, have to say pit odd, up to finally pieced together to succeed,Android version is 4.4.2, Debug Pass.Android Key Source:protected valuecallbackprotected int filechooser_resultcode = 1;Private String Mcamerafilepath;@SuppressLint ("S
Main Program:
Public class androcamera extends activity {
Private Static final int image_capture = 0;
Private button startbtn;
Private URI imageuri;
Private imageview;
/** Called when the activity is first created.* Sets the content and gets the references* The basic widgets on the screen like* {@ Code button} or {@ link imageview}*/@ OverridePublic void oncreate (bundle savedinstancestate ){Super. oncreate (savedinstancestate );Setcontentview (R. layout. Main );Imageview = (imageview) fin
This is a simple use of Android camera development flashlight function, Androidmanifest.xml file entrance is Startapp, this file is not uploaded, you can write.
Flashlight.java
Package Com.android.app;
Import android.app.Activity;
Import Android.hardware.Camera;
Import Android.hardware.Camera.Parameters;
Import Android.os.Bundle;
Import Android.view.View;
Import Android.widget.TextView;
Import Andro
Turn Android into a Network Camera: spydroid-ipcamera; real-time transmission with almost no latency,The spydroid-ipcamera project can turn Android devices into a beautiful Network camera ip address camera. Spydroid is a small app that can streams the
iOS compared to Android, the animation effect is one of the advantages, the iOS camera switch when the slide animation is very good, looking at is a 3D effect, and changes feel very natural. Android can also be through the graphics below camera can achieve 3D effect, began to try to do with this, the effect is not idea
When Android 2.3.7.r1 presses the menu key, the video is stopped. Press the menu key when you change the video to do not process it. The following modifications can be made:
In packages/apps/cameraopen/src/COM/mediatek/camera/videocamera. Java
In the onkeydown () method:
Modify
Case keyevent. keycode_menu:
If (mheadupdisplay! = NULL mglrootview! = NULL
! Malertshowing ! Mmediarecorderrecording
Mheadupdisp
When Android 2.3.7.r1 presses the menu key, the video is stopped. Press the menu key when you change the video to do not process it. The following modifications can be made:
In packages/apps/CameraOpen/src/com/mediatek/camera/VideoCamera. java
In the onKeyDown () method:
Modify
Copy codeThe Code is as follows: case KeyEvent. KEYCODE_MENU:
If (mHeadUpDisplay! = Null mGLRootView! = Null
! MAlertShowing ! MMe
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.