I am currently making a friend request module. The user clicks "Approve" the program adds the friend to the _User class on Parse Server. I believed the code below would do it, and it does, but the problem is that is changes the current user to the new friend that has been added. So if the current user is "Bob", and Bob adds "Mike" the new current user is Mike.

I've been experimenting with signUp(), signUpInBackground(), but neither seem to work.

ParseUser newFriend = new ParseUser();
newFriend.setUsername(friendRequestFrom); //friendRequestFrom is a String that carries a name
newFriend.setPassword("12345");
newFriend.signUpInBackground(new SignUpCallback() {
    @Override
    public void done(ParseException e) {
        if(e == null){
            Log.i("Parse Result","Succesful!");
            Log.i("Current User",ParseUser.getCurrentUser().getUsername());
        }
        else{
            Log.i("Parse Result","Failed " + e.toString());
        }
    }
});

0 Answers