我是Parse for Android的新手,当我运行示例项目时,我的logcat不断输出以下错误:
java.lang.IllegalStateException:尝试序列化引用新的未保存对象的命令。
有谁知道导致此错误的原因是什么?这是我的活动代码:
public class ParseStarterProjectActivity extends Activity {
EditText mTaskInput;
ListView mListView;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
mTaskInput = (EditText) findViewById(R.id.task_input);
mListView = (ListView) findViewById(R.id.task_list);
ParseObject.registerSubclass(Task.class);
}
public void createTask(View v) {
if (mTaskInput.getText().length() > 0){
Task t = new Task();
t.setDescription(mTaskInput.getText().toString());
t.setCompleted(false);
t.saveInBackground();
mTaskInput.setText("");
}
}
}
这是我的Application类:
public class ParseApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize Crash Reporting.
ParseCrashReporting.enable(this);
// Add your initialization code here
Parse.initialize(this, APPLICATION_ID, CLIENT_KEY);
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// If you would like all objects to be private by default, remove this line.
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
}