public Date getDate() {
return this.date;
}
public void setDate(Date date) {
this.date = date;
}
}
在 Activity 执行查询(多余的业务代码已经被我省略):
public class NoteActivity extends Activity {
private Box notesBox;
private Query notesQuery;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
BoxStore boxStore = ((App) getApplication()).getBoxStore();
notesBox = boxStore.boxFor(Note.class);
// query all notes, sorted a-z by their text
(http://greenrobot.org/objectbox/documentation/queries/)
notesQuery = notesBox.query().order(Note_.text).build();
updateNotes();
}
/** Manual trigger to re-query and update the UI. For a reactive alternative check {@link ReactiveNoteActivity}. */
private void update