ParseUser.getList() in parse database

75 views Asked by At

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

There are 1 answers

0
Davi Macêdo On BEST ANSWER

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