Brief introduction
Android SDK supports built-in cameras for Android devices. Support for multiple cameras starting from Android2.3 (primarily front-facing and rear-facing cameras). Photos and videos can be photographed.
Issues to consider
- Whether the camera is supported
- Take a quick photo or a custom photo
- Storage issues
Main APIs involved in cameras
- Intent heard the action to start the system's camera
- Camera
- Surfaceview
- Mediarecorder (VIDEO)
Permissions
"Android.permission.CAMERA"
"Android.permission.WRITE_EXTERNAL_STORAGE"
"Android.permission.RECORD.AUDIO"
Uses-feature: "Android.hardware.camera"
Photo examples
Public class mainactivity extends Activity { PrivateImageView image;@Override protected void onCreate(Bundle savedinstancestate) {Super. OnCreate (Savedinstancestate); Setcontentview (R.layout.main); Image = (ImageView) Findviewbyid (r.id.image); Findviewbyid (r.id.capture). Setonclicklistener (NewOnclicklistener () {@Override Public void OnClick(View v) {//TODO auto-generated method stubIntent Intent =NewIntent (mediastore.action_image_capture); Startactivityforresult (Intent,1); } }); }@Override protected void Onactivityresult(intRequestcode,intResultCode, Intent data) {if(Requestcode = =1) {if(ResultCode = = ACTIVITY.RESULT_OK) {Bitmap Camerabitmap = (Bitmap) Data.getextras (). Get ("Data"); Image.setimagebitmap (CAMERABITMAP); } } }}
Android Camera camera Technology-android learning Journey (eight)