Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

Diego Villalta
Diego Villalta
1,250 Points

ParseQuery.findInBackground is not working

Hi I am using the findInbackGround in order to gell all the elements from "Birds" table

but when I debug the code it fails in the findInBackGround method, Even I am not able to execute the done method

Any Idea?

Here is my code

ParseQuery<ParseObject> query = ParseQuery.getQuery("Birds");

// in this line the code fails
query.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> list, ParseException e) {
Birds birds = new Birds();
if (e == null) {
Log.i("FindInBackGround",""+list.size());
Log.i("message", "success");
for (ParseObject object : list) {

birds.setEnglishName(String.valueOf(object.get("English")));
birds.setSpanishName(String.valueOf(object.get("Spanish")));
birds.setTaxa(String.valueOf(object.get("Taxa")));
mbirds.add(birds);
}
BirdsAdapter adapter = new BirdsAdapter(mbirds);
mRecyclerView.setAdapter(adapter);
}
else
Log.i("FindInBackGround",""+list.size());
}
});

1 Answer

Is it the query that's not working? I've only used Parse once, in the Ribbit application so I have only got that implementation to work from. Your line here:

ParseQuery<ParseObject> query = ParseQuery.getQuery("Birds");

Looked more like this in that application:

ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Birds");

As I say, I'm no Parse expert and have only used it the once so this is just an observation that these two lines differ.

I hope it helps - apologies if it doesn't!!

Steve.