ParseUser.getList() in parse database

余生颓废 提交于 2021-01-07 01:41:35

问题


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.

I had a doubt in:

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

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?

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?


回答1:


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();


来源:https://stackoverflow.com/questions/65312284/parseuser-getlist-in-parse-database

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!