简体   繁体   中英

ParseUser.getList() in parse database

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM