Problems to return objects in Parse using android

Asked

Viewed 45 times

0

I’m having trouble returning the objects using Parse to connect to Heroku. When I search about returning objects, everyone tells me to use the following code:

ParseQuery query = new ParseQuery("Players");
query.whereEqualTo("status", "active");
query.orderByAscending("lastName"); // By lastname ascending order
query.findInBackground(new FindCallback() {
    @Override

  public void done(List<ParseObject> players, ParseException e) {

    if (players != null) {
      // Success - players contain active players

    } else {

      // Failed

                          } 

             }  

});

So that he returns a list of Parseobject and from there capture the information. However, when I try to do this Android Studio says it’s wrong. When I press alt + enter to see the solution, it gives me the solution to add the following implementations:

ParseAnalytics.trackAppOpenedInBackground(getIntent());

ParseQuery query = new ParseQuery("Players");
query.whereEqualTo("status", "active");
query.orderByAscending("lastName"); // By lastname ascending order
query.findInBackground(new FindCallback() {

@Override
  public void done(Object o, Throwable throwable) {

  }

  @Override
  public void done(List objects, ParseException e) {

  }

}

Can anyone tell me how to treat this or if it is correct? I wish to return all users who are in a collection in mongoDB that is in Heroku.

1 answer

1


To update in case someone else goes through it:

I was able to solve this by adding "new Findcallback"<"Parseobject()">""(WITHOUT THE QUOTATION MARKS) in place of "new Findcallback()" as shown below.

Way I left and it worked:

ParseQuery<ParseObject> query = ParseQuery.getQuery("_User");
    query.whereEqualTo("ID_Professor", capturaIDprofessor());
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> NomeAlunosList, ParseException {


    });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.