本文整理汇总了Java中com.facebook.Request.newPlacesSearchRequest方法的典型用法代码示例。如果您正苦于以下问题:Java Request.newPlacesSearchRequest方法的具体用法?Java Request.newPlacesSearchRequest怎么用?Java Request.newPlacesSearchRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.facebook.Request
的用法示例。
在下文中一共展示了Request.newPlacesSearchRequest方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNearPlaces
import com.facebook.Request; //导入方法依赖的package包/类
@Override
public void getNearPlaces(Location location, int radius, final ExternalDataListener dataListener) {
final Session session = Session.getActiveSession();
if (session != null & session.isOpened()) {
// Make an API call to get nearby places and define a new callback to handle the response
Request request = Request.newPlacesSearchRequest(session, location, (int)radius, 100, "",
new GraphPlaceListCallback() {
@Override
public void onCompleted(List<GraphPlace> graphPlaces, Response response) {
List<Place> places = new ArrayList<Place>();
for (GraphPlace place : graphPlaces) {
//Log.v(TAG, place.getInnerJSONObject().toString());
places.add(createPlace(place));
}
dataListener.fireCollectionAdded(places);
}
});
request.executeAsync();
}
}
示例2: createRequest
import com.facebook.Request; //导入方法依赖的package包/类
private Request createRequest(Location location, int radiusInMeters, int resultsLimit, String searchText,
Set<String> extraFields,
Session session) {
Request request = Request.newPlacesSearchRequest(session, 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;
}
示例3: createRequest
import com.facebook.Request; //导入方法依赖的package包/类
private Request createRequest(Location paramLocation, int paramInt1, int paramInt2, String paramString, Set<String> paramSet, Session paramSession)
{
Request localRequest = Request.newPlacesSearchRequest(paramSession, paramLocation, paramInt1, paramInt2, paramString, null);
HashSet localHashSet = new HashSet(paramSet);
localHashSet.addAll(Arrays.asList(new String[] { "id", "name", "location", "category", "were_here_count" }));
String str = this.adapter.getPictureFieldSpecifier();
if (str != null)
localHashSet.add(str);
Bundle localBundle = localRequest.getParameters();
localBundle.putString("fields", TextUtils.join(",", localHashSet));
localRequest.setParameters(localBundle);
return localRequest;
}