Benni
Benni

Reputation: 969

Storing/Getting values in Parse

I'm using Parse as my back-end solution and I now need to store some booleans to the server and retrieve them as well.

I have created a ParseObject:

public ParseObject prefs = new ParseObject("Prefs");

and I stored it like this:

prefs.put("setting1", true);

and saved in background:

prefs.saveInBackground();

but when I try to use the bool after retrieving it simply like this:

ParseQuery<ParseObject> query = ParseQuery.getQuery("Prefs");
    query.getInBackground(prefs.getObjectId(), new GetCallback<ParseObject>() {
        @Override
        public void done(ParseObject parseObject, ParseException e) {
            if(e==null){
                if(parseObject.getBoolean("setting1")){
                    //Do something
               } 
            } else{
                utils.toast_error("Check your internet connection");
                Gdx.app.log("PARSE", "Some "+e.getCode());
            }
        }
    });

it doesn't return true, instead it returns it core value false. Have I missed a step or something? Is there more to retrieving data than what I've tried?

Upvotes: 1

Views: 98

Answers (1)

ctarabusi
ctarabusi

Reputation: 343

Are sure to use the getInBackground method to retrieve the ParseObject?

This could be useful: https://www.parse.com/docs/android/guide#subclasses

Upvotes: 2

Related Questions