문제

With android-annotations I can replace AsyncTask<Param, Progress, Result> with @UiThread.

But is possible to handle something like onPreExcecute / onPostExecute of AsynkTask?

도움이 되었습니까?

해결책

There is no callback methods to handle this. But you can have the same result by calling methods at the beginning and at the end of your @Background annotated method (you said @UIThread but I hope this was a mistake :)).

Example :

@Background
void longRunningProcess() {
    longRunningProcessStarted();
    //...
    longRunningProcessEnded();
}

@UiThread
void longRunningProcessStarted() {

}

@UiThread
void longRunningProcessEnded() {

}

We also wrote a cookbook about this.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top