如何将列表从谷歌端点类提取到我的活动



端点类方法:

 @ApiMethod(name = "listRecords")
public List<ReplyRecord> listRecords(@Named("count") int count) {
    List<ReplyRecord> records = ofy().load().type(ReplyRecord.class).limit(count).list();
    return records;
}

AsyncTask doInBackground 中的活动方法调用

regService.record(sf.getString("regId","0"),obj.getqId(),obj.getAnsId()).execute();
        Registration.ListRecords rr= regService.listRecords(20);

这不是对 api 方法的直接调用,所以我得到了一些 Registration.ListRecords 类型对象。我真的很困惑,请建议我直接获取列表类型的方法

你快到了。 模型中的ListRecords对象基本上是一个请求,因此您还必须执行它并在完成后调用.getItems()以获取结果List

List<ReplyRecord> results = rr.execute().getItems();

最新更新