Android Camera camera Technology-android learning Journey (eight)

Source: Internet
Author: User

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)

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.