本文整理匯總了Java中cn.bmob.v3.BmobUser.setUsername方法的典型用法代碼示例。如果您正苦於以下問題:Java BmobUser.setUsername方法的具體用法?Java BmobUser.setUsername怎麽用?Java BmobUser.setUsername使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類cn.bmob.v3.BmobUser
的用法示例。
在下文中一共展示了BmobUser.setUsername方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: registerData
import cn.bmob.v3.BmobUser; //導入方法依賴的package包/類
/**
* 注冊
*/
private void registerData() {
final String name = etusername.getText().toString();
final String password = etpassword.getText().toString();
final String email = etemail.getText().toString();
BmobUser bu = new BmobUser();
bu.setUsername(name);
bu.setPassword(password);
bu.setEmail(email);
bu.signUp(new SaveListener<BmobUser>() {
@Override
public void done(BmobUser bmobUser, BmobException e) {
if(e==null){
Toast.makeText(RegisterActivity.this, "注冊成功", Toast.LENGTH_SHORT).show();
RegisterActivity.this.finish();
}else{
Toast.makeText(RegisterActivity.this, "注冊失敗", Toast.LENGTH_SHORT).show();
}}
});
}
示例2: registerBmob
import cn.bmob.v3.BmobUser; //導入方法依賴的package包/類
private void registerBmob(String userName,String passWord){
BmobUser bu = new BmobUser();
bu.setUsername(userName);
bu.setPassword(passWord);
bu.signUp(new SaveListener<BmobUser>() {
@Override
public void done(BmobUser s, BmobException e) {
if(e==null){
Toast.makeText(LoginActivity.this, "注冊成功:" +s.toString(), Toast.LENGTH_LONG).show();
}else{
Log.i("bmob","注冊失敗:"+e.getMessage()+","+e.getErrorCode());
}
}
});
}
示例3: loginBmob
import cn.bmob.v3.BmobUser; //導入方法依賴的package包/類
private void loginBmob(){
final String account=accountNum.getText().toString();
final String psword= psw.getText().toString();
if(account.length()==0 || psword.length()==0){//當賬號或密碼的輸入為空時提示
Toast.makeText(this, "請輸入賬號密碼", Toast.LENGTH_SHORT).show();
return;
}
BmobUser bu = new BmobUser();
bu.setUsername(account);
bu.setPassword(psword);
bu.login(new SaveListener<BmobUser>() {
@Override
public void done(BmobUser s, BmobException e) {
if(e==null){
Toast.makeText(LoginActivity.this, "登陸成功" , Toast.LENGTH_LONG).show();
editor=pref.edit();
if(checkBox.isChecked()){
editor.putBoolean("remember_password",true);
editor.putString("account",account);
editor.putString("password",psword);
}else {
editor.clear();}
editor.apply();
Intent intent = new Intent(LoginActivity.this,MainActivity.class);
startActivity(intent);
finish();
}else{
if(e.getErrorCode()==9016){
Toast.makeText(LoginActivity.this, "網絡不可用,請檢查你的網絡連接", Toast.LENGTH_SHORT).show();
}else {
Toast.makeText(LoginActivity.this,"賬號或密碼錯誤(password or account is not valid)",Toast.LENGTH_LONG).show();
}
Log.i("bmob","登陸失敗:"+e.getMessage()+","+e.getErrorCode());
}
}
});
}