Android: Support for multi-select local albums

Source: Internet
Author: User

A time ago in a dynamic publishing function, need to use the image upload. The system albums and cameras that were called directly from the beginning, because the system camera does not support multiple selection, took a moment to do a local album, under this open source.

First, select the album Interface, the album Details screen, view the image map interface

Album list by the number of pictures in descending order, album details list by the picture time descending order, compared to the next and QQ album, read the file basically consistent.

Next, the album file traversal ideas. The first step is certainly not to traverse through the folder, so the efficiency is too low. Checked the API found that Android's system database has stored all the picture path and thumbnail path (if any), can be obtained directly through the ContentProvider, get a large map of the URI is

MediaStore.Images.Media.EXTERNAL_CONTENT_URI

The URI that gets the thumbnail is

MediaStore.Images.Thumbnails.EXTERNAL_CONTENT_URI

My practice is to go through all the large graphs, get the ID and path, and then through the ID of the large map to find the thumbnail path, in the album is displayed in thumbnails, so as to improve the display speed, while reducing memory overhead. But it takes a little time to find the thumbnail with a large image ID, so it turns on thread execution when the app starts. The Localimagehelper class is used to perform this operation.

To be perfected: The album initialization is placed on the app startup, the initialization is no longer re-execution, so if after the app is turned on, the device added a new picture or deleted pictures, the in-app cache album will still not change, the next can be opened every time the album and local pictures to do a comparison, Make an update to the new and deleted images.

The demo uses the Imageloader library to display images, using Android Studio development.

GitHub Address: Https://github.com/LinJZong/LocalAlbum.git

Android: Support for multi-select local albums

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.