Loadermanager Use specific explanation (iv)---example: applistloader

Source: Internet
Author: User

Example: Applistloader
This article will be my fourth, and the last article in the series. Please tell me whether they are practical in the comments. Links to previous articles such as the following:
One: Loaders before the worldSecond: Learn about Loadermanagerthree: Realize loadersFour: Example: Applistloader
In response to public demand. I have written a demo sample application demonstrating how to implement a self-defined loader correctly. The app name is: Applistloader, which is a demo app. Ability to query and parallel all installed apps on your Android device.

The app has changed. Build again (without bugs) the Loadercustom.java sample provided in API demos. The app uses Applistloader (subclasses of Asynctaskloader) to query the data and uses Loadermanager to manage loader content in the Activity/fragment declaration cycle.

Applistloader has registered two Broadcastreceiver to monitor the system-wide broadcasts that affect the underlying data source (note: The installation and uninstallation of the app will send broadcasts, both of which will affect the data source we need to listen to.) So this is the meaning of the sentence. It's a good problem to translate.) The new installation, update, and removal application is monitored by installedappobserver. Localization change (locale changed) is monitored by systemlocaleobserver. For example, when a user changes the language from English to Spanish, Systemlocaleobserver will detect it. and notify Applistloader to query the data again. This allows the program to display the Spanish name for each app (assuming that each app provides the appropriate Spanish name). Click on the "Change Language" button and observe the loader's seamless response to the event (very cool, isn't it.)

)。
When a Loader/loadermanager event occurs, the log information is displayed in the Logcat. So when analyzing logcat, remember to make sure the program is executing.

Hopefully it will be better for you to understand loader and loadermanager working together, and to understand the impact of activity/fragment life cycle on them.

Ability to filter using the app name "Com.adp.loadercustom" to get better results.


You can download the app from Google Play by clicking on the link below:

The source code is available on GitHub. Download. Import into Eclipse. Do whatever changes you want to make.


Assuming this series of articles are practical, please leave your comments below to let me know. As always. Please be free to ask questions.
Translator Note: two days of fragmented time translated four articles, the harvest is very large, at the same time feel loader and Loadermanager is not as difficult as imagined. The quality of the article is very high, if you have friends to know better Android related articles, please let me know, alone lele than the public lele.

Loadermanager Use specific explanation (iv)---example: applistloader

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.