我尝试了很多时间,我得到的领域空无数据问题是有任何错误,最后我什么都没有,我调试项目我发现size = 1但所有数据= null,我的班级模型纠正我检查它,为什么这样做?
private class ImportAsyncTask extends AsyncTask<Void, Integer, Integer> {
JSONObject jsonObject;
private ImportAsyncTask(JSONObject jsonObject) {
this.jsonObject = jsonObject;
}
@Override
protected Integer doInBackground(Void... voids) {
Realm r = Realm.getInstance(getActivity());
r.beginTransaction();
r.createOrUpdateObjectFromJson(ApplicationBean.class, jsonObject);
r.commitTransaction();
int sum=r.allObjects(ApplicationBean.class).size();
return sum;
}
@Override
protected void onPostExecute(Integer integer) {
RealmResults<ApplicationBean> im = realm.where(ApplicationBean.class).findAll();
for( ApplicationBean a: im )
{
Log.e("<<<<<>>>>"+a.getApplication().getParameters().getTitle(),"démarrage de PostExecute");
}
}
}
}
我的json的一部分是:
{
application: {
parameters: {},
cart: {},
home_swipe: {},
sections: [],
tabs: [],
tablet_home_grid: {},
phone_home_grid: {},
attributes: [ ],
wine_maps: [ ],
agenda_groups: [ ]
}
}