解析数据库中的 ParseUser.getList() [英] ParseUser.getList() in parse database

查看:44
本文介绍了解析数据库中的 ParseUser.getList()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个类似推特的应用程序,我们可以在其中关注其他用户并阅读他们的推文.

I am creating a twitter like app where we can follow other users and read their tweets.

ParseUser.getCurrentUser().getList("isFollowing").remove(users.get(position));
List<String> tmpUsers=ParseUser.getCurrentUser().getList("isFollowing");
ParseUser.getCurrentUser().remove("isFollowing");
ParseUser.getCurrentUser().put("isFollowing", tmpUsers);

上面的代码在用户想要取消关注时运行.

The above code runs when user wants to unfollow.

我有一个疑问:

ParseUser.getCurrentUser().getList("isFollowing").remove(users.get(position));
List<String> tmpUsers=ParseUser.getCurrentUser().getList("isFollowing");

当我们使用 ParseUser.getCurrentUser().getList("isFollowing").remove(users.get(position));我们是从数据库下载列表并在本地删除元素吗?

when we are using ParseUser.getCurrentUser().getList("isFollowing").remove(users.get(position)); are we downloading the list from the database and removing the element locally?

当我们运行List时tmpUsers=ParseUser.getCurrentUser().getList("isFollowing"); 我们是再次下载列表还是获取删除了 users.get(position) 的列表?

When we run List<String> tmpUsers=ParseUser.getCurrentUser().getList("isFollowing"); are we downloading the list again or are we getting the list which has users.get(position) removed?

推荐答案

您不是在下载"任何这些行中的列表.您正在访问已缓存在设备中的列表.为了获取您需要使用的最新数据:

You are not "downloading" the list in any of these lines. You are accessing the list that is already cached in your device. In order to fetch the latest data you need to use:

ParseUser.getCurrentUser().fetch();

这篇关于解析数据库中的 ParseUser.getList()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆