我想从服务类中选择带有实时数据的房间数据库数据。观察时如何投射LifecycleOwner?
repositoryDatabase.getTimeline().observe(this, timelineList -> {
if (timelineList != null && timelineList.size() >= 10) {
JSONArray arrayTimeline = new JSONArray();
for (TimelineEntity timeline : timelineList) {
JSONObject objectTimeline = new JSONObject();
try {
objectTimeline.put("doku", timeline.getIdDokumen());
objectTimeline.put("entrydate", timeline.getEntryDate());
objectTimeline.put("lat", timeline.getLat());
objectTimeline.put("lng", timeline.getLng());
arrayTimeline.put(objectTimeline);
} catch (JSONException e) {
e.printStackTrace();
}
}
onUpdateLocation(arrayTimeline.toString());
}
});
呼如林
婷婷同学_
湖上湖
相关分类