【发布时间】:2015-06-01 17:10:57
【问题描述】:
我一创建 parseobject 就将其固定到本地数据存储。当我检索使用以下代码固定的 parseobject 时,在我的 android 活动中,我能够提取所有记录,但我无法检索任何对象的 createdAt 和 updatedAt 字段。我该怎么做才能找回它们?
如果 parse 没有将这些值分配给固定在本地数据存储区 parseobjects 中,有没有办法可以附加一个自定义的 updatedAt 字段来自行处理时间戳更新?
ParseQuery<PostChoice> query = ParseQuery.getQuery("PostChoice");
query.fromPin("collegeUserChoice");
query.findInBackground(new FindCallback<PostChoice>() {
@Override
public void done(List<PostChoice> list, ParseException e) {
for(PostChoice pc:list)
{
Log.i("updatedAt" , pc.getCreatedAt().toString() /*(pc.getCreatedAt()).toString()*/);
// **this line throws java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String java.util.Date.toString()' on a null object reference**
}
}
});
java.lang.NullPointerException:尝试在空对象引用上调用虚拟方法“java.lang.String java.util.Date.toString()”
【问题讨论】: