How to use KinveyReference to create a Friends List?
B
Bartek
started a topic
almost 5 years ago
Hey! I m trying to implement friends list within my app however i have a problem with getting the users back. This is my code so far and KinveyReferences are being added to User.USER_COLLECTION_NAME.
mKinveyClient.user().put(KinveyConstants.FRIENDS, new ArrayList<KinveyReference>())
KinveyReference friend = new KinveyReference(User.USER_COLLECTION_NAME, friendId);
((ArrayList<KinveyReference>) mKinveyClient.user().get(KinveyConstants.FRIENDS)).add(friend);
mKinveyClient.user().update(new KinveyUserCallback() {
@Override
public void onSuccess(User user) {
Toast.makeText(AddFriendActivity.this, "update successful", Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Throwable throwable) {
Toast.makeText(AddFriendActivity.this, "Something went wrong: " + throwable.getMessage(), Toast.LENGTH_SHORT).show();
}
});
However now i don t know how to get all friends of my active user. I m trying something like that but it does not seem to work.
Bartek
Hey!
I m trying to implement friends list within my app however i have a problem with getting the users back. This is my code so far and KinveyReferences are being added to User.USER_COLLECTION_NAME.
However now i don t know how to get all friends of my active user. I m trying something like that but it does not seem to work.
Can someone show what am i doing wrong here?