本文整理汇总了Java中com.avos.avoscloud.AVUser.fetchInBackground方法的典型用法代码示例。如果您正苦于以下问题:Java AVUser.fetchInBackground方法的具体用法?Java AVUser.fetchInBackground怎么用?Java AVUser.fetchInBackground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.avos.avoscloud.AVUser
的用法示例。
在下文中一共展示了AVUser.fetchInBackground方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateUserInfo
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static void updateUserInfo() {
AVUser user = AVUser.getCurrentUser();
if (user != null) {
user.fetchInBackground("friends", new GetCallback<AVObject>() {
@Override
public void done(AVObject avObject, AVException e) {
if (e == null) {
AVUser avUser = (AVUser) avObject;
DemoApplication.registerUserCache(avUser);
}
}
});
}
}
示例2: updateUserInfo
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
public static void updateUserInfo() {
AVUser user = AVUser.getCurrentUser();
if (user != null) {
user.fetchInBackground("friends", new GetCallback<AVObject>() {
@Override
public void done(AVObject avObject, AVException e) {
if (e == null) {
// User avUser = (User) avObject;
// App.registerUserCache(avUser);
}
}
});
}
}
示例3: getView
import com.avos.avoscloud.AVUser; //导入方法依赖的package包/类
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v;
final ViewHolder viewHolder;
final AVObject item=comments.get(position);
if(convertView==null){
v= LayoutInflater.from(StoryActivity.this).inflate(R.layout.story_comment_item,null);
viewHolder=new ViewHolder();
viewHolder.iv_user= (ImageView) v.findViewById(R.id.iv_story_comment_user);
viewHolder.tv_user= (TextView) v.findViewById(R.id.tv_story_comment_user);
viewHolder.tv_time= (TextView) v.findViewById(R.id.tv_story_comment_time);
viewHolder.tv_content= (TextView) v.findViewById(R.id.tv_story_comment_content);
v.setTag(viewHolder);
}else {
v=convertView;
viewHolder= (ViewHolder) v.getTag();
}
final AVUser avUser=item.getAVUser("user");
if(avUser!=null){
avUser.fetchInBackground(new GetCallback<AVObject>() {
@Override
public void done(AVObject avObject, AVException e) {
AVFile avFile = avUser.getAVFile("logo");
if(avFile!=null){
if(!StoryActivity.this.isDestroyed())
Glide.with(StoryActivity.this).load(avFile.getUrl()).crossFade().into(viewHolder.iv_user);
}else {
if(!StoryActivity.this.isDestroyed())
Glide.with(StoryActivity.this).load(R.drawable.logo).crossFade().into(viewHolder.iv_user);
}
viewHolder.tv_user.setText(avUser.getUsername());
}
});
}else {
viewHolder.tv_user.setText("游客");
}
Date date=item.getDate("updatedAt");
// String s=DateUtils.getRelativeTimeSpanString(StoryActivity.this, date.getTime()).toString();
viewHolder.tv_time.setText(RelativeDateFormat.format(date));
viewHolder.tv_content.setText(item.getString("content"));
return v;
}