About how Android calls the system image browser and returns the image path

Source: Internet
Author: User

The method for calling the system image browser is as follows:

Java code

  1. Intent intent = new intent (intent. action_pick, Android. provider. mediastore. Images. Media. external_content_uri );
  2. Startactivityforresult (intent, image_select );

 

 

The activitity callback method is as follows:

 

 

Java code
  1. Protected void onactivityresult (INT requestcode, int resultcode, intent data)
  2. {
  3. If (resultcode = activity. result_ OK)
  4. {
  5. Uri uri = data. getdata ();
  6. Cursor cursor = This. getcontentresolver (). Query (Uri, null );
  7. Cursor. movetofirst ();
  8. For (INT I = 0; I <cursor. getcolumncount (); I ++)
  9. {// Obtain the column name and detailed information of the image URI
  10. System. Out. println (I + "-" + cursor. getcolumnname (I) + "-" + cursor. getstring (I ));
  11. }
  12. }
  13. }

 

Note: All articles are for reference only. Do not throw bricks. Thank you!

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.