本文整理汇总了Java中com.avos.avoscloud.AVUser.put方法的典型用法代码示例。如果您正苦于以下问题:Java AVUser.put方法的具体用法?Java AVUser.put怎么用?Java AVUser.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVUser
的用法示例。
在下文中一共展示了AVUser.put方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fillAvUser
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static AVUser fillAvUser(User user,AVUser avUser){
if (user == null || avUser == null)
return null;
Field[] fields = user.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
field.setAccessible(true);
try {
if ("objectId".equals(field.getName())){
avUser.setObjectId((String) field.get(user));
}else {
avUser.put(field.getName(), field.get(user));
}
} catch (IllegalAccessException e) {
NLog.e(TagUtil.makeTag(UserCacheHelper.class),e);
}
}
return avUser;
}
示例2: 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);
}
示例3: updateUserLocation
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static void updateUserLocation() {
PreferenceMap preferenceMap = PreferenceMap.getCurUserPrefDao(DemoApplication.context);
AVGeoPoint lastLocation = preferenceMap.getLocation();
if (lastLocation != null) {
final AVUser user = AVUser.getCurrentUser();
final AVGeoPoint location = user.getAVGeoPoint("location");
if (location == null || !Utils.doubleEqual(location.getLatitude(), lastLocation.getLatitude())
|| !Utils.doubleEqual(location.getLongitude(), lastLocation.getLongitude())) {
user.put("location", lastLocation);
user.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e != null) {
e.printStackTrace();
} else {
Log.v("lan", "lastLocation save " + user.getAVGeoPoint("location"));
}
}
});
}
}
}
示例4: saveUserToCloud
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public void saveUserToCloud(UserWrap datas){
if (datas != null) {
AVUser avUser = AVUser.getCurrentUser();
if (avUser != null) {
for (String key : datas.keySet()) {
avUser.put(key, datas.get(key));
}
avUser.saveInBackground();
}
}
}
示例5: 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);
}
示例6: updateUserLocation
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static void updateUserLocation() {
PreferenceMap preferenceMap = PreferenceMap
.getCurUserPrefDao(DemoApplication.context);
AVGeoPoint lastLocation = preferenceMap.getLocation();
String lastaddress = preferenceMap.getAddress();
if (lastLocation != null) {
final AVUser user = AVUser.getCurrentUser();
final AVGeoPoint location = user.getAVGeoPoint("location");
final String Address = user.getString("address");
if (location == null
|| !Utils.doubleEqual(location.getLatitude(),
lastLocation.getLatitude())
|| !Utils.doubleEqual(location.getLongitude(),
lastLocation.getLongitude())) {
user.put("location", lastLocation);
user.put("address", lastaddress);
user.saveInBackground(new SaveCallback() {
@Override
public void done(AVException e) {
if (e != null) {
e.printStackTrace();
} else {
log.v("lastLocation save "
+ user.getAVGeoPoint("location"));
}
}
});
}
}
}
示例7: 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);
}
}