Back to project page cat-walk.
The source code is released under:
MIT License
If you think the Android project cat-walk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package net.rdyonline.catwalk.data.api.cat; /*from www .j a v a 2 s .co m*/ import java.util.List; import net.rdyonline.catwalk.data.Image; import net.rdyonline.catwalk.data.api.XmlApi; import net.rdyonline.catwalk.data.api.cat.ICat.ResponseWrapper; import retrofit.RetrofitError; import android.util.Log; public class CatApi extends XmlApi { private String TAG = CatApi.class.getSimpleName(); public CatApi(String domain) { super(domain); } /** * Fetch a page of cats at a time * * @param pageNumber * @return all of the {@link Image} that are available on the page */ public List<Image> getPage(int pageNumber) { final ResponseWrapper wrapper; try { wrapper = newInstance(ICat.class).getCats(pageNumber); } catch (RetrofitError e) { Log.e(TAG, e.getMessage()); return null; } return parseResponse(wrapper); } /*** * Look inside the wrapper and extract the images * * @param wrapper * the direct result of binding * @return list of POJO */ private List<Image> parseResponse(ResponseWrapper wrapper) { return wrapper.data.images; } }