Android Implementation call system album and photo Demo sample _android

Source: Internet
Author: User

This article describes the Android implementation call system album and photo Demo sample. Share to everyone for your reference, specific as follows:

Recently, I have seen several people in the group talk about the Internet, some of the Android call system photo albums and photo demo have bugs, there are problems, not a complete. Yes, I remember one months ago, one of my classmates had this problem, and it was fine in a lower version of the system, and it crashed with a system above the 4.4 version. So, I still want to extract out, for everyone to tidy up, a relatively complete bug-free demo, let everyone collection, save for later use.

In fact, to call the phone library, the high version of the system will crash, because the acquisition method has changed, so we should make a judgment. The method is as follows:

Intent Intent;
if (Build.VERSION.SDK_INT <) {
intent = new Intent (intent.action_get_content);
Intent.settype ("image/*");
} else {
Intent = new Intent (
Intent.action_pick,android.provider.mediastore.images.media.external_content_ URI);
Startactivityforresult (Intent, request_code_picture);

This will easily solve the problem of the crash.

I hope this article will help you with the Android program.

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.