@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.register_activity); intView(); }
@Override // 当有消息发送出来的时候就执行Handler的这个方法 public void handleMessage(Message msg) { super.handleMessage(msg); // 处理UI switch (msg.what) { case 1000: Toast.makeText(context, "恭喜你,注册成功!", Toast.LENGTH_SHORT).show(); SharedPreferencesUtil.setFirstLoginSharedPreferences(context, "isFirstLogin", true); Intent intent = new Intent(RegisterActivity.this, SexualSelectionActivity.class); startActivity(intent); break; case 1001: Toast.makeText(context, "注册失败,请再次尝试!", Toast.LENGTH_SHORT).show(); break; case 1002: Toast.makeText(context, "提示验证码已发送,请注意查收!", Toast.LENGTH_SHORT).show(); break; case 1003: Toast.makeText(context, "验证码发送失败,请检查输入参数并再次尝试!", Toast.LENGTH_SHORT).show(); break; case 1004: Toast.makeText(context, registerResult, Toast.LENGTH_SHORT).show(); break; default: break; } }