Works fine so far, but I can't cancel the thread in this way. I could cancel the task, but I have to check within the data collect loop of the calllog class if the onCancelled is called but this function is only known in the class GetDataTask and not in CallLog.

Is there a way to use AsyncTask and make "outside" classes cancelable? Or have I switch to Threads and events? What's the best way in this situation?

1 Answer
1

I know this code. My problem is I don't know how I can tell the CallLog.getData() function that there is a cancel request and it should stop the loop? The CallLog.getData() is in extra class outside the class MyClass and class GetDataTask.
–
hitziJul 6 '11 at 6:40

I belive there is some way to make the cancel-call propergate upwards. If you in onCancelled inside the GetDataTask make a call to super.cancel(); will that maybe work? EDIT I think i misread it. Is it maybe a solution to in the onCancelled event, set a flag in CallLog? And then in CallLog, handle this flag in order to stop the looping.
–
lobnerJul 6 '11 at 6:56