Last active
December 30, 2015 06:29
-
-
Save shikajiro/7789442 to your computer and use it in GitHub Desktop.
@backgroundと@UiThread
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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