You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First, thanks for this great library !
But I got an issue (or maybe a misunderstanding from myself) : I want to cancel a started AsyncJob in case we dismiss manually a loading dialog but when I call AsyncJob.cancel() it seems to have no effects. The callback onResult is still call with the result of doAsync() like nothing has happened.
What I was assuming is that the cancel() method would
Avoid onResult to be call.
Or call it with a flag like "CANCELLED"
But I don't have any way of telling if my AsyncJob has been cancelled.
Here is my code :
final AsyncJob<StatisticsTable> asyncJob = new AsyncJob<>();
asyncJob.setActionInBackground(new AsyncJob.AsyncAction<StatisticsTable>() {
@Override
public StatisticsTable doAsync() {
return DashboardHelper.getInstance().getDashboard(
StatisticsActivity.this,
period,
DashboardHelper.DASHBOARD_TYPE.values()[position]
);
}
});
asyncJob.setActionOnResult(new AsyncJob.AsyncResultAction<StatisticsTable>() {
@Override
public void onResult(StatisticsTable table) {
dismissLoadingDialog();
switchFragment(NAVIGATION_INDEX_DASHBOARD_ITEM, table);
}
});
//Add a cancel listener on the loading dialog to cancel the async task once the user
//has manually dismiss the dialog.
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
asyncJob.cancel();
}
});
asyncJob.start();
Thank's for help !
The text was updated successfully, but these errors were encountered:
Hi !
First, thanks for this great library !
But I got an issue (or maybe a misunderstanding from myself) : I want to cancel a started
AsyncJob
in case we dismiss manually a loading dialog but when I callAsyncJob.cancel()
it seems to have no effects. The callbackonResult
is still call with the result ofdoAsync()
like nothing has happened.What I was assuming is that the
cancel()
method wouldonResult
to be call.But I don't have any way of telling if my
AsyncJob
has been cancelled.Here is my code :
Thank's for help !
The text was updated successfully, but these errors were encountered: