You need to put ALLOC_DELETED_CHAIN(MyTask); in the body of the class definition.
ALLOC_DELETED_CHAIN(MyTask);
You may also find this useful, to avoid the boilerplate of creating AsyncTask subclasses: