如何将列表从 google 端点 class 提取到我的 activity?
How to extract list from google endpoint class to my activity?
端点class方法:
@ApiMethod(name = "listRecords")
public List<ReplyRecord> listRecords(@Named("count") int count) {
List<ReplyRecord> records = ofy().load().type(ReplyRecord.class).limit(count).list();
return records;
}
activity AsyncTask doInBackground 中的方法调用
regService.record(sf.getString("regId","0"),obj.getqId(),obj.getAnsId()).execute();
Registration.ListRecords rr= regService.listRecords(20);
这不是对 api 方法的直接调用,所以我得到了一些 Registration.ListRecords 类型的对象。我真的很困惑,请建议我直接输入 List 的方法
你快到了。模型中的 ListRecords
对象基本上是一个请求,因此您还必须执行它并调用 .getItems()
以获得结果 List
完成后:
List<ReplyRecord> results = rr.execute().getItems();
端点class方法:
@ApiMethod(name = "listRecords")
public List<ReplyRecord> listRecords(@Named("count") int count) {
List<ReplyRecord> records = ofy().load().type(ReplyRecord.class).limit(count).list();
return records;
}
activity AsyncTask doInBackground 中的方法调用
regService.record(sf.getString("regId","0"),obj.getqId(),obj.getAnsId()).execute();
Registration.ListRecords rr= regService.listRecords(20);
这不是对 api 方法的直接调用,所以我得到了一些 Registration.ListRecords 类型的对象。我真的很困惑,请建议我直接输入 List 的方法
你快到了。模型中的 ListRecords
对象基本上是一个请求,因此您还必须执行它并调用 .getItems()
以获得结果 List
完成后:
List<ReplyRecord> results = rr.execute().getItems();