use of com.facebook.widget.PickerFragment in project Klyph by jonathangerbaud.
the class PlacePickerActivity method onCreate.
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
destroyed = false;
setTitle(R.string.choose_place);
placePickerFragment = (KlyphPlacePickerFragment) getSupportFragmentManager().findFragmentById(R.id.place_picker_fragment);
placePickerFragment.setOnSelectionChangedListener(new PickerFragment.OnSelectionChangedListener() {
@Override
public void onSelectionChanged(PickerFragment<?> fragment) {
GraphPlace place = placePickerFragment.getSelection();
if (place != null) {
Intent intent = new Intent();
intent.putExtra(KlyphBundleExtras.PLACE_ID, place.getId());
intent.putExtra(KlyphBundleExtras.PLACE_NAME, place.getName());
setResult(RESULT_OK, intent);
finish();
}
}
});
placePickerFragment.setOnErrorListener(new PickerFragment.OnErrorListener() {
@Override
public void onError(PickerFragment<?> fragment, FacebookException error) {
PlacePickerActivity.this.onError(error);
}
});
placePickerFragment.setShowTitleBar(false);
}
Aggregations