Android Open Source - acs-android-sdk C C Pagination






From Project

Back to project page acs-android-sdk.

License

The source code is released under:

Apache License

If you think the Android project acs-android-sdk 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.appcelerator.cloud.sdk;
//from   www . jav  a  2  s .  c o  m
import org.json.JSONException;
import org.json.JSONObject;

public class CCPagination {
  private int page; // current page
  private int perPage; // per page count
  private int totalPages; // total pages can be returned
  private int totalResults; // total number of results

  public int getPage() {
    return page;
  }

  public int getPerPage() {
    return perPage;
  }

  public int getTotalPages() {
    return totalPages;
  }

  public int getTotalResults() {
    return totalResults;
  }

  public CCPagination(JSONObject jObject) throws ACSClientError {
    try {
      page = Integer.parseInt(jObject.getString("page").trim());
    } catch (NumberFormatException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: page should be a number");
    } catch (JSONException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: missing page");
    }

    try {
      perPage = Integer.parseInt(jObject.getString("per_page").trim());
    } catch (NumberFormatException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: perPage is not a number");

    } catch (JSONException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: missing perPage");
    }

    try {
      totalPages = Integer.parseInt(jObject.getString("total_pages").trim());
    } catch (NumberFormatException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: totoalPages is not a number");
    } catch (JSONException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: missing totalPages");
    }

    try {
      totalResults = Integer.parseInt(jObject.getString("total_results").trim());
    } catch (NumberFormatException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: totalResults is not a number");
    } catch (JSONException e) {
      throw new ACSClientError("Invalid Server Response: CCPagination: missing totalResults");

    }
  }
}




Java Source Code List

com.appcelerator.cloud.demo.BaloonLayout.java
com.appcelerator.cloud.demo.CheckinAdapter.java
com.appcelerator.cloud.demo.DemoApplication.java
com.appcelerator.cloud.demo.DemoSession.java
com.appcelerator.cloud.demo.Explore.java
com.appcelerator.cloud.demo.MyDlgCustomizer.java
com.appcelerator.cloud.demo.PlaceAdapter.java
com.appcelerator.cloud.demo.PlaceView.java
com.appcelerator.cloud.demo.SignUp.java
com.appcelerator.cloud.demo.TabView.java
com.appcelerator.cloud.demo.UserView.java
com.appcelerator.cloud.pushdemo.ArrivalActivity.java
com.appcelerator.cloud.pushdemo.CustomReceiver.java
com.appcelerator.cloud.pushdemo.ExtendedReceiver.java
com.appcelerator.cloud.pushdemo.GCMUtility.java
com.appcelerator.cloud.pushdemo.PushActivity.java
com.appcelerator.cloud.pushdemo.PushNotificationsManager.java
com.appcelerator.cloud.sdk.ACSClientError.java
com.appcelerator.cloud.sdk.ACSClient.java
com.appcelerator.cloud.sdk.CCConstants.java
com.appcelerator.cloud.sdk.CCMeta.java
com.appcelerator.cloud.sdk.CCMultipartEntity.java
com.appcelerator.cloud.sdk.CCObject.java
com.appcelerator.cloud.sdk.CCPagination.java
com.appcelerator.cloud.sdk.CCRequestMethod.java
com.appcelerator.cloud.sdk.CCResponse.java
com.appcelerator.cloud.sdk.CCUser.java
com.appcelerator.cloud.sdk.SerializableCookie.java
com.appcelerator.cloud.sdk.oauth2.ACSClientDialog.java
com.appcelerator.cloud.sdk.oauth2.DialogError.java
com.appcelerator.cloud.sdk.oauth2.DialogListener.java
com.appcelerator.cloud.sdk.oauth2.DlgCustomizer.java
com.appcelerator.cloud.sdk.oauth2.Util.java
com.appcelerator.com.cloud.demotest.TestDriver.java