Android Open Source - Android-Google-Places-API Search Result






From Project

Back to project page Android-Google-Places-API.

License

The source code is released under:

Copyright (c) 2013 Fuji, Goro (gfx). Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the ...

If you think the Android project Android-Google-Places-API listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.gfx.googleplaces;
// w  ww.  j  av  a2s.c o  m
import com.google.api.client.util.Key;

import java.io.Serializable;
import java.util.Iterator;
import java.util.List;

// https://developers.google.com/places/documentation/search
public class SearchResult implements Serializable, Iterable<Place>, ResultBase {
    public static final String OK = "OK";
    public static final String ZERO_RESULTS = "ZERO_RESULTS";
    public static final String OVER_QUERY_LIMIT = "OVER_QUERY_LIMIT";
    public static final String REQUEST_DENIED = "REQUEST_DENIED";
    public static final String INVALID_REQUEST = "INVALID_REQUEST";

    private RequestError error; // to return an error

    @Key
    public String status;

    @Key
    public List<String> html_attributions;

    @Key
    public String next_page_token;

    @Key
    public List<Place> results;

    // delegate to results

    public int size() {
        return results.size();
    }

    public Place get(int n) {
        return results.get(n);
    }

    @Override
    public Iterator<Place> iterator() {
        return results.iterator();
    }

    @Override
    public RequestError getError() {
        if (error != null) {
            return error;
        }
        else if (! OK.equals(status)) {
            return new RequestError(status, null, null);
        }
        else {
            return null;
        }
    }

    @Override
    public void setError(RequestError error) {
        this.error = error;
    }

    @Override
    public boolean isSuccess() {
        return error == null && OK.equals(status);
    }
}




Java Source Code List

com.github.gfx.googleplaces.GooglePlaces.java
com.github.gfx.googleplaces.LruMap.java
com.github.gfx.googleplaces.PlaceDetail.java
com.github.gfx.googleplaces.PlaceListOrder.java
com.github.gfx.googleplaces.Place.java
com.github.gfx.googleplaces.RequestError.java
com.github.gfx.googleplaces.ResultBase.java
com.github.gfx.googleplaces.SearchResult.java
com.github.gfx.googleplaces.demo.ApiType.java
com.github.gfx.googleplaces.demo.ItemDetailActivity.java
com.github.gfx.googleplaces.demo.ItemDetailFragment.java
com.github.gfx.googleplaces.demo.ItemListActivity.java
com.github.gfx.googleplaces.demo.ItemListFragment.java