Multi-thread update of listview nested gallery Gallery

Source: Internet
Author: User

Update the progress bar of each book in the bookcase form (listview nested Gallery:

1. Complete Compilation of multi‑thread and resumable download drivers;

2. Use the service to start the download task and inherit from the service. If intentservice is inherited, The onhandleintent method can only process one intent at a time, and the next intent is processed sequentially after the intent ends;

3. Broadcast update Interface

 

Because listview is nested with gallery, the current task status is determined in Gallery. setonclickitemlistener of listadapter. The current task status is not downloaded, downloaded, or paused, and different responses are made. Then add the broadcast receiver to the galleryadapter to update the current Gallery.

Because it is a multi-task download, it means to declare a global variable, used to record "rows, columns, progress", type isMap <string, Map <integer, integer>. When starting a task, pass the value of the row and column into the service through intent, then pass in the downloader in the service, and finally expose it in the listener of the downloader, transmits rows, columns, and progress together to the receiver through broadcast. The progress bar is displayed for judging global variables in getview of galleryadapter.

Other questions: how do I pause a download task for a download loader ?? The main problem is how to obtain the objects of the Custom Service class.

Effect

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.