Good design patterns for coding many HTTP requests in Android

In my application, I have many GET, POST, PUT requests. Right now, I have a singleton class that contains my loaded data and has many inner classes that extend AsyncTask. In my singleton class, I also have several such interfaces:

/**
* Handlers for notifying listeners when data is downloaded
* 
*/
public interface OnQuestionsLoadedListener {

    public void onDataLoadComplete();

    public void onDataLoadingError();       
}

Is there something wrong with this template (many inner classes extending AsyncTask)? Could this be done more efficiently, perhaps just one inner class for each HTTP call (1 for GET, 1 for POST, ...)? If so, how to decide what to do after, for example, a GET request?

+5
source share
3 answers

, AsyncTasks .

AsyncTasks . , , AsyncTask . , , , . , "" - , , .

, , .

RoboSpice. , , , AsyncTasks . , , .

+4

.

ido , . resultceceiver . http- async- -.

ui ( ) .

+1

, , , WebRequest, GET, POST, PUT ..

"Connector", AsyncTask . , , , Http.

, , .

, , , , Asynctask, ( ), URL- , ( , , ).

0

All Articles