Android SDK Version
  • java.lang.Object
    • com.facebook.GraphResponse

public class GraphResponse
extends java.lang.Object
Encapsulates the response, successful or otherwise, of a call to the Facebook platform.
Nested Class Summary
Modifier and TypeClass and Description
static class GraphResponse.PagingDirection
Indicates whether paging is being done forward or backward.
Field Summary
Modifier and TypeField and Description
static java.lang.StringNON_JSON_RESPONSE_PROPERTY
Property name of non-JSON results in the GraphObject.
static java.lang.StringSUCCESS_KEY 
Method Summary
Modifier and TypeMethod and Description
java.net.HttpURLConnectiongetConnection()
Returns the HttpURLConnection that this response was generated from.
FacebookRequestErrorgetError()
Returns information about any errors that may have occurred during the request.
JSONArraygetJSONArray()
The response returned for this request, if it's in array form.
JSONObjectgetJSONObject()
The response returned for this request, if it's in object form.
java.lang.StringgetRawResponse()
Returns the server response as a String that this response is for.
GraphRequestgetRequest()
Returns the request that this response is for.
GraphRequestgetRequestForPagedResults(GraphResponse.PagingDirection direction)
If a Response contains results that contain paging information, returns a new Request that will retrieve the next page of results, in whichever direction is desired.
java.lang.StringtoString()
Provides a debugging string for this response.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Field Detail

NON_JSON_RESPONSE_PROPERTY

public static final java.lang.String NON_JSON_RESPONSE_PROPERTY
Property name of non-JSON results in the GraphObject. Certain calls to Facebook result in a non-JSON response (e.g., the string literal "true" or "false"). To present a consistent way of accessing results, these are represented as a GraphObject with a single string property with this name.

SUCCESS_KEY

public static final java.lang.String SUCCESS_KEY
Method Detail

getError

public final FacebookRequestError getError()
Returns information about any errors that may have occurred during the request.
Returns:
the error from the server, or null if there was no server error

getJSONObject

public final JSONObject getJSONObject()
The response returned for this request, if it's in object form.
Returns:
the returned JSON object, or null if none was returned (or if the result was a JSON array)

getJSONArray

public final JSONArray getJSONArray()
The response returned for this request, if it's in array form.
Returns:
the returned JSON array, or null if none was returned (or if the result was a JSON object)

getConnection

public final java.net.HttpURLConnection getConnection()
Returns the HttpURLConnection that this response was generated from. If the response was retrieved from the cache, this will be null.
Returns:
the connection, or null

getRequest

public GraphRequest getRequest()
Returns the request that this response is for.
Returns:
the request that this response is for

getRawResponse

public java.lang.String getRawResponse()
Returns the server response as a String that this response is for.
Returns:
A String representation of the actual response from the server

getRequestForPagedResults

public GraphRequest getRequestForPagedResults(GraphResponse.PagingDirection direction)
If a Response contains results that contain paging information, returns a new Request that will retrieve the next page of results, in whichever direction is desired. If no paging information is available, returns null.
Parameters:
direction - enum indicating whether to page forward or backward
Returns:
a Request that will retrieve the next page of results in the desired direction, or null if no paging information is available

toString

public java.lang.String toString()
Provides a debugging string for this response.
Overrides:
toString in class java.lang.Object