Reputation: 23
I am attempting to use the Parse local datastore (from the Parse API) feature on Android and am having a problem at the very first step, I simply pasted the sample code:
Parse.enableLocalDatastore(this);
Parse.initialize(this, "xxxxxxxxxxxxxxxxxxxxxxxxxxx", "xxxxxxxxxxxxxxxxxxxxxxxxxxx");
ParseObject gameScore = new ParseObject("GameScore");
gameScore.put("score", 1337);
gameScore.put("playerName", "Sean Plott");
gameScore.put("cheatMode", false);
gameScore.pinInBackground();
And Android studio gives the following error: cannot find symbol method pinInBackground()
As a second question, ultimately I would like to have an adapter available to use offline, i.e:
ParseQueryAdapter<ParseObject> adapter = new ParseQueryAdapter<ParseObject>(this, "TestObject");
adapter.pinInBackground();
are the above two lines of code possible??
Upvotes: 2
Views: 2403
Reputation: 186
To your second Question:
ParseQueryAdapter<ParseObject> adapter = new ParseQueryAdapter<ParseObject>(this, "TestObject");
adapter.pinInBackground();
No, it is not possible. Please read the documentation to understand how to works the ParseQueryAdapter. Parse Android User Interface
Upvotes: 1
Reputation: 186
For your first Question: You have to set a SaveCallback()
gameScore.pinInBackground( new SaveCallback( ) {
@Override
public void done( ParseException e ) {
if( e == null ) {
//success
} else {
//fail
}
}
} );
Upvotes: 3