Java 如何显示下一页谷歌自定义搜索结果?

Java 如何显示下一页谷歌自定义搜索结果?,java,android,rest,google-custom-search,Java,Android,Rest,Google Custom Search,我知道SOF有很多类似的问题,但我没有发现对我有用的东西。根据谷歌自定义搜索文档,&start参数: The start parameter uses a zero-based index, meaning the first result is 0, the second result is 1 and so forth. The start parameter works in conjunction with the num parameter to determine which se

我知道SOF有很多类似的问题,但我没有发现对我有用的东西。根据谷歌自定义搜索文档,
&start
参数:

The start parameter uses a zero-based index, meaning the first result is 0, the second result is 1 and so forth.

The start parameter works in conjunction with the num parameter to determine which search results to return. 
我尝试从零开始发送,但应用程序崩溃。在此尝试中,我尝试发送:

对于1页:
&num=10&start=1

对于2页:
&num=10&start=11

但它仍然需要1页<代码>&开始参数始终被忽略

我正在编写一个android应用程序,它可以进行图像搜索,在向下滚动时,它应该显示下一页(下10幅图像),在android中,它总是返回1页和10幅图像,我在浏览器中测试了请求,使用ount
&num
参数,它可以工作。在android上,在加载第一页之后,参数
&start
&num
似乎被忽略

我正在使用robospice进行改装,我不知道如何查看字符串,可能是我做错了什么

这是我的界面:

 public static final String BASE_URL = "https://www.googleapis.com/customsearch";
public static final String API_KEY = "AIzaSyCCuxxVLzm2sZP-adhRNYKeSck1mMMgsAM";
public static final String CUSTOM_SEARCH_ID = "001734592082236324715:sob9rqk49yg";
public static final String SEARCH_TYPE_IMAGE = "image";
static final String FILTER = "&fields=queries(nextPage(startIndex,count),request(startIndex,count)),searchInformation(totalResults),items(title,link,displayLink,mime," +
        "image)";
static final String QUERY = "/v1?key="+API_KEY+
                            "&cx="+CUSTOM_SEARCH_ID+
                            "&searchType="+SEARCH_TYPE_IMAGE+FILTER+"&num=10";

@GET(QUERY)
public GoogleSearchResponse search(@Query("q") String query,
                                   @Query("start") long startIndex);
香料请求

public class SampleRetrofitSpiceRequest extends RetrofitSpiceRequest<GoogleSearchResponse,GoogleSearchInterface> {

String query;
long startIndex;

public SampleRetrofitSpiceRequest(String query, long startIndex) {
    super(GoogleSearchResponse.class, GoogleSearchInterface.class);
    this.query = query;
    this.startIndex = startIndex;
}
@Override
public GoogleSearchResponse loadDataFromNetwork() throws Exception {
    return getService().search(query,startIndex);
}}
现在,我如何请求获取第一个结果页面,在页面参数中我发送1个结果页面,在中获取第二个结果页面中我发送11个结果页面:

 public void sendRequest(String query,int page){
    searchQuery = query;
    request = new SampleRetrofitSpiceRequest(query, page);

    spiceManager.execute(request, query, DurationInMillis.ONE_WEEK, new RequestImageListener());
    request=null;
}
这是响应侦听器,下一页是下一页的编号:

 private class RequestImageListener implements RequestListener<GoogleSearchResponse> {
    @Override
    public void onRequestFailure(SpiceException spiceException) {
        Toast.makeText(context, "failure", Toast.LENGTH_SHORT).show();
    }
    @Override
    public void onRequestSuccess(GoogleSearchResponse s) {
        Toast.makeText(context,"success",Toast.LENGTH_SHORT).show();
        nextPage = s.queries.getNextPage().startIndex;
        Log.d("myTag","nextPage "+currentPage);
        updateSearchResults(s.items);
    }
}
私有类RequestImageListener实现RequestListener{
@凌驾
公共void onRequestFailure(SpiceException){
Toast.makeText(上下文,“失败”,Toast.LENGTH_SHORT).show();
}
@凌驾
public void onRequestSuccess(谷歌搜索响应){
Toast.makeText(上下文,“success”,Toast.LENGTH_SHORT).show();
nextPage=s.querys.getNextPage().startIndex;
Log.d(“myTag”、“下一页”+当前页);
更新搜索结果(s.项目);
}
}
更新日志显示custom
SpiceRequest
不会发出新请求,即使我发出了新的请求实例。

似乎可以使用“start=PUT\u NUMBER\u HERE”URL选项获得更多结果

Number是结果的序号,从1开始

例如:

您找到了实现这一目标的方法吗?答案有用吗?
 private class RequestImageListener implements RequestListener<GoogleSearchResponse> {
    @Override
    public void onRequestFailure(SpiceException spiceException) {
        Toast.makeText(context, "failure", Toast.LENGTH_SHORT).show();
    }
    @Override
    public void onRequestSuccess(GoogleSearchResponse s) {
        Toast.makeText(context,"success",Toast.LENGTH_SHORT).show();
        nextPage = s.queries.getNextPage().startIndex;
        Log.d("myTag","nextPage "+currentPage);
        updateSearchResults(s.items);
    }
}