If that's really necessary, I would think you could add an abstraction layer between Android's AsyncTask and your base class:

class NetWorker {
// does http work
}

class NetWorkerFoo extends NetWorker {
}

class NetWorkerBar extends NetWorker {
}

class NetAsyncTask {
execute(NetWorker worker);
}

In this design, AsyncTask is one-shot, but NetWorker objects can be reused. All the common code you referred to below is in NetWorker, not in NetAsyncTask, so you can just take an existing (failed) NetWorker and give it to a new async task.

BTW, the Harmony HTTP API has its own retry logic - you might want to take a look, see if that alone would serve your needs.

-- Kostya

07.02.2011 8:22, Dimitris пишет:
Yes it is necessary. The base abstract class provides all the plumbing for posting an HTTP request and handling exceptions while allowing subclasses to do their actual work. I would hate for each asynctask to write network error handling.

The problem is, I cant find a proper way to reinstantiate a task and execute it without reflection.

Thanks for the time.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


--
Kostya Vasilyev -- WiFi Manager + pretty widget -- http://kmansoft.wordpress.com

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to