我已经开始研究最近引入的 android 架构组件。
DataLiveList.getPhotoDataList().observe(PhotosFragmentNew.this, new Observer<List<PhotoDataLive>>() {
@Override
public void onChanged(@Nullable List<PhotoDataLive> photoDataLives) {
}
});
我的问题是我只想要最后添加的元素而不是数据库中所有项目的列表,其次我想知道为新模型自动生成的 id,在插入元素时获取该 id 的最佳方法是什么。