Android Camera attention issues

Source: Internet
Author: User

Intent Intent = new Intent (mediastore.action_image_capture);

              Startactivityforresult (Intent, Reqcode);//reqcode is the return code.

              But when some phones return data in protected void Onactivityresult (int requestcode, int resultcode, Intent data), then we're going to think of some way to solve it, This is a cell phone problem.


We want to set the system camera to take photos when the picture file is stored
Intent.putextra (Mediastore.extra_output, URI);



The complete code is as follows:

String path= "";


Intent Intent = new Intent ();
Specifies the action to turn on the system camera
Intent.setaction (mediastore.action_image_capture);
Intent.addcategory (Intent.category_default);


File File = new file (constant. Cache_path, String.valueof (System
. Currenttimemillis ()) + ". jpg");
if (file.exists ()) {
File.delete ();
}
Convert the file address into a URI format
Uri uri = uri.fromfile (file);


Path = File.getpath ();
Set the storage address of the picture file when the system camera takes a photo
Intent.putextra (Mediastore.extra_output, URI);


Startactivityforresult (Intent, 100);


protected void Onactivityresult (int requestcode, int resultcode, Intent data) {

Span style= "White-space:pre" >
if (Requestcode = && ResultCode = = RESULT_OK) {



Super.onactivityresult (Requestcode, ResultCode, data);


imageloader.displayimage ("file://" + Path, Iv_logo, options);


}
}

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.