cherry-wave cherry-wave - 1 year ago 168
Android Question

Android: Alternatives to AsyncTask?

for my app I made a framework for all network calls to an external API. I put everything in "Services" like:

etc. So now when I want to call a network method I can't do this in the UI-Thread of my
so I made an
and everything was just fine =)

But now I want something like giving the method to execute to the
so I don't need to write an
for every method of my network-framework. So instead of having something like this:

public class NetworkTask extends AsyncTask<UserService, Void, Void> {

protected Void doInBackground(UserService... params) {
UserService userService = params[0];
return null;

I want something more "abstract" so the
doesn't need to know the "getUser" method? But I can't find any idea of how to do this... Maybe the AsyncTask is not good for this anyway?

Answer Source

There are plenty AsyncTask alternatives :

and plus Needle - Multithreading library for Android

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download