在后台处理异常?
Handling exception in background?
我发现我被迫在后台线程中抛出异常:
@Background
void bootstrap() throws IOException {
mProgressBar.setVisibility(View.VISIBLE);
restClient.setBearerAuth(Auth.token);
UserID userIdJsonn = restClient.getUserId();
Auth.user_id= userIdJsonn.getUser_id();
PhoenixPlug.getInstance().ini();
mProgressBar.setVisibility(View.GONE);
}
当然,我遇到了这个错误:
Error:(619, 5) error: org.androidannotations.annotations.Background annotated methods should not declare throwing any exception
那么,处理这种情况的推荐方法是什么?
如果您使用背景注释,则必须在本地捕获异常。
我发现我被迫在后台线程中抛出异常:
@Background
void bootstrap() throws IOException {
mProgressBar.setVisibility(View.VISIBLE);
restClient.setBearerAuth(Auth.token);
UserID userIdJsonn = restClient.getUserId();
Auth.user_id= userIdJsonn.getUser_id();
PhoenixPlug.getInstance().ini();
mProgressBar.setVisibility(View.GONE);
}
当然,我遇到了这个错误:
Error:(619, 5) error: org.androidannotations.annotations.Background annotated methods should not declare throwing any exception
那么,处理这种情况的推荐方法是什么?
如果您使用背景注释,则必须在本地捕获异常。