Android makes the mobile phone photo function development (source sharing)

Source: Internet
Author: User

Android calls the phone camera function there are two ways to call the phone directly with the camera and one is to watch your own beats.

Example Camera360 powerful one in each operating system has a mobile phone photography software; You can capture different styles, different effects of photos, the same time with cloud services and Internet sharing features, the global users have more than 250 million. Now specialized in the development of a mobile phone photography software certainly does not have much meaning, already than just these predecessors. We just need to learn how to call the mobile phone comes with the camera finished taking pictures and get the photos, to provide users with upload avatar, publish text and micro-blog, the ability to transfer pictures.

Complete the above functions is very simple, even do not need to add any permissions in the manifest file, just need a step to achieve.

Package Com.example.g06_camera01;import Android.os.bundle;import Android.app.activity;import Android.content.intent;import Android.graphics.bitmap;import Android.view.view;import Android.widget.Button; Import Android.widget.imageview;public class Mainactivity extends Activity {private ImageView imageview;private Button Button;private final int camrea_resquset = 1; @Overrideprotected void OnCreate (Bundle savedinstancestate) { Super.oncreate (savedinstancestate); Setcontentview (r.layout.activity_main); ImageView = (ImageView) This.findviewbyid (r.id.imageview1); button = (button) This.findviewbyid (R.id.button1); Button.setonclicklistener ( New View.onclicklistener () {@Overridepublic void OnClick (View v) {//TODO auto-generated method Stubintent Intent = new in   Tent (Android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Startactivityforresult (Intent, Camrea_resquset);});} Use the callback value of intent to infer whether the photo has been shot completed @overrideprotected void onactivityresult (int requestcode, int resultcode, Intent data) {//TODO auto-generated Method Stubsuper.onactivityresult (Requestcode, ResultCode, data); if (Requestcode = = Camrea_resquset && ResultCode = = RESULT_OK) {Bundle bundle = Data.getextras (); Bitmap Bitmap = (Bitmap) bundle.get ("Data"); Imageview.setimagebitmap (Bitmap);}}}


Copyright notice: This article blog original articles, blogs, without consent, may not be reproduced.

Android makes the mobile phone photo function development (source sharing)

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.