Demo entry 6687387

wew

   

Submitted by anonymous on Dec 28, 2017 at 10:20
Language: Java. Code size: 773 Bytes.

private void login(){
	String username = et_username.getText().toString().trim();
	String password = et_password.getText().toString().trim();
	if(TextUtils.isEmpty(username)){
		showToast("用户名不能为空");
		return;
	}
	if(TextUtils.isEmpty(password)){
		showToast("密码不能为空");
		return;
	}

	mProgressDialog.setMessage("正在登录中...");
	mProgressDialog.show();

	BmobUser bu = new BmobUser();
	bu.setUsername(username);
	bu.setPassword(password);
	bu.login(new SaveListener<BmobUser>() {

		@Override
		public void done(BmobUser bmobUser, BmobException e) {
			mProgressDialog.dismiss();
			if (e == null) {
				showToast("登录成功");
				intent2Activity(MainActivity.class);
				finish();
			} else {
				showToast("登录失败:"+e.getMessage());
			}
		}
	});
}

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).