0

Followed the online Parse docs to get the value but Android Studio won't recognize the getInt method & says - Cannot resolve method 'getInt(java.lang.String)

Shouldn't I be able to access the object inside the done callback? Currently the line is commented out because I can't build the project due to the error?

ParseQuery<ParseObject> query = ParseQuery.getQuery("Stats");
query.whereEqualTo("Name", rstr);
query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> stats, ParseException e) {

            if (e == null) {
                Log.d("score", "Retrieved " + stats.size() + " scores");
                //int score = stats.getInt("errors");
            } else {
                Log.d("score", "Error: " + e.getMessage());
            }
        }
    });

2 Answers 2

1

You need to fetch the ParseObject from the stats variable first, like below

ParseObject object = (ParseObject) stats.get(position);
int score = object.getInt("errors");
Sign up to request clarification or add additional context in comments.

Comments

0

stats is not a ParseObject, it's a List<ParseObject>. You need to get the objects out of the list.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.