Skip to content

Instantly share code, notes, and snippets.

@shikajiro
Last active December 30, 2015 06:29
Show Gist options
  • Save shikajiro/7789442 to your computer and use it in GitHub Desktop.
Save shikajiro/7789442 to your computer and use it in GitHub Desktop.
@backgroundと@UiThread
public class MainActivity extends Activity {
// 省略
@Background
void login(String username, String password) {
try {
webApi.login(username, password);
callbackLogin();
} catch (HttpClientErrorException e) {
callbackLoginMiss(e);
} finally {
if (progressDialog != null)
progressDialog.dismiss();
}
}
@UiThread
void callbackLogin() {
// 正常終了の時の処理
}
@UiThread
void callbackLoginMiss(HttpClientErrorException e) {
// エラーの時の処理
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment