本文整理汇总了Java中com.avos.avoscloud.AVUser.setUsername方法的典型用法代码示例。如果您正苦于以下问题:Java AVUser.setUsername方法的具体用法?Java AVUser.setUsername怎么用?Java AVUser.setUsername使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVUser
的用法示例。
在下文中一共展示了AVUser.setUsername方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: uploadStory
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
/**
* 上传指定信息的story
* @param username
* @param url
* @param lat
* @param lng
* @param title
*/
private void uploadStory(String username, final String url, final double lat, final double lng, final String title){
final AVUser avUser=new AVUser();
avUser.setUsername(username + title.hashCode());
avUser.setPassword("123456");
avUser.signUpInBackground(new SignUpCallback() {
@Override
public void done(AVException e) {
if (e == null) {
AVGeoPoint geoPoint = new AVGeoPoint(lat, lng);
AVObject story = new AVObject("story");
story.put("provider", avUser);
story.put("geoPoint", geoPoint);
story.put("content", title);
story.put("url", url);
story.saveInBackground();
} else {
Log.e("upload story error", e.toString());
}
}
});
}
示例2: signUpByPhoneNumber
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
/**
* 通过手机号注册
*
* @param phoneNumber 手机号
* @param password 密码
*/
private void signUpByPhoneNumber(String phoneNumber, String password) {
AVUser user = new AVUser();
user.setUsername(phoneNumber); // 暂时设置用户名为手机号码
user.setPassword(password);
user.setMobilePhoneNumber(phoneNumber);
Log.i("tag", phoneNumber);
user.signUpInBackground(new SignUpCallback() {
@Override
public void done(AVException e) {
if (e == null) {
// 注册通过,等待验证
SignUpSecondStepActivity_.intent(SignUpFirstStepActivity.this).start();
} else {
e.printStackTrace();
showToast("该手机号已注册");
}
}
});
}
示例3: fillFriendsData
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void fillFriendsData(List<AVUser> datas) {
friends.clear();
int total = datas.size();
for (int i = 0; i < total; i++) {
AVUser user = datas.get(i);
AVUser sortUser = new AVUser();
sortUser.put("avatar", user.getAVFile("avatar"));
sortUser.setUsername(user.getUsername());
sortUser.setObjectId(user.getObjectId());
String username = sortUser.getUsername();
if (username != null) {
String pinyin = CharacterParser.getPingYin(user.getUsername());
String sortString = pinyin.substring(0, 1).toUpperCase();
if (sortString.matches("[A-Z]")) {
Log.d("lan", sortString.toUpperCase());
} else {
Log.d("lan", "#");
}
} else {
Log.d("lan", "#");
}
friends.add(sortUser);
}
Collections.sort(friends, pinyinComparator);
}
示例4: register
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public void register(String userName,String password,String phoneNumber){
AVUser avUser = new AVUser();
avUser.setUsername(userName);
avUser.setPassword(password);
avUser.put("mobilePhoneNumber",phoneNumber);
avUser.signUpInBackground(mRegisterCallback);
}
示例5: register
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void register(){
String account=et_account.getText().toString();
String password=et_password.getText().toString();
AVUser avUser=new AVUser();
avUser.setUsername(account);
avUser.setPassword(password);
avUser.signUpInBackground(new SignUpCallback() {
@Override
public void done(AVException e) {
if(e==null){
//返回activity
Intent intent=new Intent();
setResult(RESULT_OK,intent);
intent.putExtra("account",et_account.getText().toString());
intent.putExtra("password",et_password.getText().toString());
finish();
}else {
final Dialog dialog=new Dialog(RegisterActivity.this,"错误","注册失败,请检查你的账号与密码");
dialog.show();
dialog.getButtonAccept().setText("好的");
dialog.getButtonAccept().setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
dialog.dismiss();
}
});
}
}
});
}
示例6: register
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static void register(final String username,final String password,final String cityStr,final String githubStr,final Uri avatar_uri,final SaveCallback saveCallback) {
final AVUser user = new AVUser();
String name = System.currentTimeMillis()+"";
if (avatar_uri != null) {
byte[] data = ImageUtils.readFile(mContext,avatar_uri);
final AVFile file = new AVFile(name, data);
file.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e != null) {
Log.d("wds",e.toString());
} else {
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) {
user.setUsername(username);
user.setPassword(password);
}
user.put(UserDAO.LOCATION,cityStr);
user.put(UserDAO.GITHUB_URL,githubStr);
user.put(UserDAO.AVATAR_URL, file.getUrl());
user.saveInBackground(saveCallback);
}
}
});
}else {
if (!TextUtils.isEmpty(username) && !TextUtils.isEmpty(password)) {
user.setUsername(username);
user.setPassword(password);
}
user.put(UserDAO.LOCATION,cityStr);
user.put(UserDAO.GITHUB_URL,githubStr);
user.saveInBackground(saveCallback);
}
}
示例7: attemptSignUp
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
private void attemptSignUp() {
// Reset errors.
mEmail.setError(null);
mMobileNumber.setError(null);
boolean cancel = false;
boolean should_go_to_home_activity = false;
boolean has_email = false;
View focusView = null;
String username = mUsername.getText().toString();
String password = mPassword.getText().toString();
final String mobileNumber = mMobileNumber.getText().toString();
String email = mEmail.getText().toString();
AVUser nUser =new AVUser();
//nUser.setEmail(null);
// Check for a valid password, if the user entered one.
if (!TextUtils.isEmpty(password) && !isPasswordValid(password)) {
mPassword.setError(getString(R.string.error_invalid_password));
focusView = mPassword;
cancel = true;
}
if (TextUtils.isEmpty(email)) {
has_email = false;
}else if(emailValidation(email)){
has_email =true;
} else {
mEmail.setError(getString(R.string.error_invalid_email));
focusView = mEmail;
cancel = true;
}
if(TextUtils.isEmpty(mobileNumber)){
should_go_to_home_activity =true;
} else {
if(!isMobileNumberValid(mobileNumber)) {
mMobileNumber.setError(getString(R.string.error_invalid_mobile_phone));
focusView = mPassword;
cancel = true;
should_go_to_home_activity =false;
}
}
if (cancel) {
focusView.requestFocus();
} else {
nUser.setUsername(username);
nUser.setPassword(password);
if(has_email){
nUser.setEmail(email);
}
if(!TextUtils.isEmpty(mobileNumber)) {
nUser.setMobilePhoneNumber(mobileNumber);
}
final boolean finalShould_go_to_home_activity = should_go_to_home_activity;
nUser.signUpInBackground(new SignUpCallback() {
@Override
public void done(AVException e) {
if (e == null) {
if (finalShould_go_to_home_activity) {
startActivity(new Intent(getApplicationContext(), HomeActivity.class));
} else {
Intent intent = new Intent(getApplicationContext(), VerifyMoblieNumber.class);
Bundle b = new Bundle();
b.putString("mobile_number", mobileNumber);
intent.putExtras(b);
startActivity(intent);
}
} else {
Log.e("SignUp", e.getMessage());
}
}
});
}
}