On Sun, Feb 6, 2011 at 9:35 PM, Dimitris <[email protected]> wrote:

> I have a base abstract class that all my asynctasks extend from. I have
> built in error handling for network errors where I display a dialog to the
> user telling them they can retry their request (after all it was a network
> error...).


It seems strange to have error handling code for network errors in a base
class - is every single AysncTask you ever use going to require networking?


> I am having a bit of a problem "retrying" my asynctask since once it is
> executed, you cannot execute it again. How could I go by do that ? Should I
> use reflection to instantiate the same class and retry?
>
> Has anyone dealt with this problem before?
>

I have not, but based on your description, it sounds like you're giving your
base class more responsibility than it should have. An AsyncTask should,
ideally, represent one long-running operation to be executed. Whether it
succeeds or fails is irrelevant to it's job - that should be the caller's
responsibility to deal with.

-------------------------------------------------------------------------------------------------
TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago
transit tracking app for Android-powered devices

-- 
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