use of com.facebook.GraphRequest in project facebook-android-sdk by facebook.
the class PlacePickerFragment method createRequest.
private GraphRequest createRequest(Location location, int radiusInMeters, int resultsLimit, String searchText, Set<String> extraFields) {
AccessToken accessToken = AccessToken.getCurrentAccessToken();
GraphRequest request = GraphRequest.newPlacesSearchRequest(accessToken, location, radiusInMeters, resultsLimit, searchText, null);
Set<String> fields = new HashSet<String>(extraFields);
String[] requiredFields = new String[] { ID, NAME, LOCATION, CATEGORY, WERE_HERE_COUNT };
fields.addAll(Arrays.asList(requiredFields));
String pictureField = adapter.getPictureFieldSpecifier();
if (pictureField != null) {
fields.add(pictureField);
}
Bundle parameters = request.getParameters();
parameters.putString("fields", TextUtils.join(",", fields));
request.setParameters(parameters);
return request;
}
use of com.facebook.GraphRequest in project facebook-android-sdk by facebook.
the class GraphObjectPagingLoader method requestCompleted.
private void requestCompleted(GraphResponse response) {
GraphRequest request = response.getRequest();
if (request != currentRequest) {
return;
}
loading = false;
currentRequest = null;
FacebookRequestError requestError = response.getError();
FacebookException exception = (requestError == null) ? null : requestError.getException();
if (response.getJSONObject() == null && exception == null) {
exception = new FacebookException("GraphObjectPagingLoader received neither a result nor an error.");
}
if (exception != null) {
nextRequest = null;
if (onErrorListener != null) {
onErrorListener.onError(exception, this);
}
} else {
addResults(response);
}
}
Aggregations