Ejemplo n.º 1
0
 private void doRegister(String userName, String passWord, String confirPsw) {
   if ("".equals(userName) || "".equals(passWord) || "".equals(confirPsw)) {
     T.showShort(PMRegisterActivity.this, "用户名或密码不能为空");
   } else if (passWord.equals(confirPsw)) {
     UserInfo ui = new UserInfo();
     ui.setAge(Math.round(100) + "");
     ui.setAvatarUrl("http://img5.imgtn.bdimg.com/it/u=3638412718,2736228005&fm=21&gp=0.jpg");
     ui.setBirthday("2011-11-11");
     ui.setPassWord(passWord);
     ui.setSex("女");
     String pinyin = characterParser.getSelling(userName);
     String sortString = pinyin.substring(0, 1).toUpperCase();
     // 正则表达式,判断首字母是否是英文字母
     if (sortString.matches("[A-Z]")) {
       ui.setSortLetters(sortString);
     } else {
       ui.setSortLetters("#");
     }
     ui.setUserDesc("com.lidroid.xutils.exception.HttpException:unauthorized");
     ui.setUserName(userName);
     if (ui.save()) {
       setResult(
           00001,
           new Intent(this, PMLoginActivity.class)
               .putExtra("user_name", userName)
               .putExtra("pass_word", passWord));
       PMRegisterActivity.this.finish();
     } else {
       T.showShort(PMRegisterActivity.this, "注册失败");
     }
   } else {
     T.showShort(PMRegisterActivity.this, "用户密码输入不一致,请重新输入");
   }
 }
Ejemplo n.º 2
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   setContentView(R.layout.register_activity);
   characterParser = CharacterParser.getInstance();
   initview();
 }