[Design] RSS aggregator on Android

Source: Internet
Author: User

I made an RSS aggregator on Android. Although it is very simple, I still have to say that it is still somewhat designed.

 

1. simplest implementation

Write several required activities and jump between these interfaces to complete all functions.

Disadvantages: 1. Single thread, the UI will be blocked by network access

2. The implementation logic is a straight line, making it very clumsy to jump back to the complicated logic.

 

2. Implementation of the C/S Mode

The main service mainservice is the main thread. It abstracts various tasks into task tasks and submits them to the handler of mainservice for processing. It cyclically detects tasks and starts a thread for each task to execute them.

Define an interface irssactivity:

//All activities implement this interface.Public InterfaceIrssactivity {//Create a task in init and hand it over to mainservice for it to doPublic VoidInit ();//Refresh activity and mainservice callback. This method refreshes the UI at the end of the task.Public VoidRefresh (object... Param );}

Advantages: 1. If you want to do anything anywhere, you only need to hand over a task to mainservice, just like it will go back and do it. If you need to refresh the UI.

 

There is still a problem: how to handle the memory and manage the memory.

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.