public void handleMessage(Message msg) { switch (msg.what) { case CHECK: if (result != null) { if (Integer.parseInt(result.getRows()) > 0) { Map<String, String> list = result.getTab1(); if (list != null && list.size() > 0) { // 是业主 ,可以发送验证码 xqid = list.get("xqid"); yzmCode = RandomSecquenceCreator.getRandomCode(5); // 生成随机数 String str = yzmCode + " 天健E生活验证码。【柠檬95】"; LogUtils.i(TAG, str); sendYzm(loginName, str); } else { PromptManager.closeProgressDialog(); PromptManager.showToast(getApplicationContext(), "该手机号未注册"); } } else { PromptManager.closeProgressDialog(); PromptManager.showToast(getApplicationContext(), "该手机号未注册"); } } else { PromptManager.closeProgressDialog(); PromptManager.showToast(getApplicationContext(), "服务器异常请稍候再试"); } break; case MSG: if (result2) { PromptManager.closeProgressDialog(); PromptManager.showToast(getApplicationContext(), "验证码发送成功"); // 进入下一页,输入验证码和重置密码 Intent intent = new Intent(FindPwdOneActivity.this, FindPwdTwoActivity.class); intent.putExtra("xqid", xqid); intent.putExtra("yzmCode", yzmCode); intent.putExtra("loginName", loginName); startActivity(intent); overridePendingTransition(R.anim.left_in, R.anim.left_up); } else { PromptManager.closeProgressDialog(); PromptManager.showToast(getApplicationContext(), "验证码发送失败"); } break; } };
private void checkPhone(final String loginName2) { PromptManager.showProgressDialog(this, "获取中,请稍候..."); new Thread() { public void run() { result = WebServiceUtils.info(loginName2); Message msg = new Message(); msg.what = CHECK; handler.sendMessage(msg); }; }.start(); }
@Override public void onClick(View v) { switch (v.getId()) { case R.id.top_back: finish(); overridePendingTransition(R.anim.right_in, R.anim.right_out); break; case R.id.login_but: loginName = login_phone.getText().toString().trim(); if (StringUtils.isBlank(loginName)) { PromptManager.showToast(getApplicationContext(), "请输入您的手机号"); return; } if (!StringUtil.isPhone(loginName)) { PromptManager.showToast(getApplicationContext(), "请输入正确格式的手机号"); return; } checkPhone(loginName); break; } }