Best way is to call delegate. In your AsyncTask
class make a constructor and have a delegate
Delegate interface:
public interface TaskDelegate {
public void taskCompletionResult(String result);
}
now in AsyncTask
:
private TaskDelegate delegate;
public ListingFoundBeaconService(Context contextGiven,
JSONObject jsonParams,
TaskDelegate delegate) {
this.contextGiven = contextGiven;
this.jsonParams = jsonParams;
this.delegate = delegate;
}
on postExecute
:
delegate.taskCompletionResult(result/msg/json);
In your main class implement TaskDelegate
and implemented a method which is called when the task completed.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…