I'm using parse.com as a backend for my Android app. One thing that bothered me when i was writing the code is
@Override
public void onCreate() {
super.onCreate();
Parse.initialize(this, APPLICATION_ID, CLIENT_KEY);
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
}
Why should you declare the parseobject in onCreate()
method?
Can we declare a ParseObject
inside the main method that looks something like
public static void main(String[] args) {
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
}
If i do this the class is not getting created in the backend. So, I'm looking for a specific reason why ParseObject
needs to be created inside onCreate()
method?