-1

I've tried addding the class in manifest and all other things mentioned in other questions, still no luck

public class StarterApplication extends Application {

  @Override
  public void onCreate() {
    super.onCreate();

    // Enable Local Datastore.
   // Parse.enableLocalDatastore(this);

    
      Parse.initialize(new Parse.Configuration.Builder(this)
              .applicationId("******")
              .clientKey("********")
              .server("********")
              .build()
      );

    ParseObject object = new ParseObject("LOL");
    Log.i("Okay", "Done");
    object.put("myNumber", "123");
    object.put("myString", "Divya");
    Log.i("Addded", "test");

    object.saveInBackground(new SaveCallback() {
      @Override
      public void done(ParseException e) {
          if (e == null) {
              e.printStackTrace();
          } else{
              Log.i("Yes", "Done");
          }
      }
    });

    /*object.saveInBackground(new SaveCallback () {
      @Override
      public void done(ParseException ex) {
        if (ex == null) {
          Log.i("Parse Result", "Successful!");
        } else {
          Log.i("Parse Result", "Failed" + ex.toString());
        }
      }
    });
*/

    //ParseUser.enableAutomaticUser();

    ParseACL defaultACL = new ParseACL();
    defaultACL.setPublicReadAccess(true);
    defaultACL.setPublicWriteAccess(true);
    ParseACL.setDefaultACL(defaultACL, true);

  }
}

I've properly given my app id server keys and other

Hulk
  • 6,399
  • 1
  • 30
  • 52

1 Answers1

0

Look at your code, when e is null, you are trying to invoke a method on it. Instead, the code should be :

object.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
  if (e != null) {
      e.printStackTrace();
  } else {
      Log.i("Yes", "Done");
   }
  }
});
Sagar D
  • 2,588
  • 1
  • 18
  • 31