0

Hi i made ParseObject which contains a field called Usuario which is a pointer to _User(ParseUser class)

My class Conversaciones

ive been trying to query for this value with no success...

private void queryConversaciones(){
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Conversaciones");
    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> objects, ParseException e) {
            for (ParseObject obj:objects
                 ) {
                mensaje=obj.getString("Mensaje");
                enviaMensaje= (ParseUser) obj.get("Usuario");

               // mMessageList.add(obj);

            }
        }
    });
}
Tom Fox
  • 897
  • 3
  • 14
  • 34
Felipe Franco
  • 171
  • 3
  • 15
  • If it has solved your issue, it would be helpful if you could accept my answer. If not, let me know and I will try to help further. – Tom Fox Apr 27 '19 at 22:12

1 Answers1

1

Just add query.include("key"); to retrieve the pointer object.

So your complete query should look like this:

private void queryConversaciones(){
    ParseQuery<ParseObject> query = ParseQuery.getQuery("Conversaciones");

    // Include data at pointer
    query.include("Usuario");

    query.findInBackground(new FindCallback<ParseObject>() {
        @Override
        public void done(List<ParseObject> objects, ParseException e) {
            for (ParseObject obj:objects
                 ) {
                mensaje=obj.getString("Mensaje");
                enviaMensaje= (ParseUser) obj.get("Usuario");

               // mMessageList.add(obj);

            }
        }
    });
}

Now you should be able to access all the data stored in the _User object.

I got all this information from the relational queries section in the Parse Android guide.

Tom Fox
  • 897
  • 3
  • 14
  • 34