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

时间:2023-02-11 23:12:16

Endpoint class method:

端点类方法:

 @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 method call inside AsyncTask doInBackground

在AsyncTask doInBackground中调用activity方法

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

this is not a direct call to api method so I get some Registration.ListRecords type object. Iam really confused please suggest me the way to get List type directly

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

1 个解决方案

#1


1  

You're almost there. The ListRecords object in the model is basically a request, so you also have to execute it and call .getItems() to get the resultant List when done:

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

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

#1


1  

You're almost there. The ListRecords object in the model is basically a request, so you also have to execute it and call .getItems() to get the resultant List when done:

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

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