私はそう
try
{
PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
Intent intent = intentBuilder.build(getActivity());
// Start the Intent by requesting a result, identified by a request code.
startActivityForResult(intent, ET_PLACE_PICKER_REQUEST);
} catch (GooglePlayServicesRepairableException e)
{
GooglePlayServicesUtil
.getErrorDialog(e.getConnectionStatusCode(), getActivity(), 0);
} catch (GooglePlayServicesNotAvailableException e)
{
Toast.makeText(getActivity(), "Google Play Services is not available.",
Toast.LENGTH_LONG)
.show();
}
とActivityResult中を(行うことにより、GoogleのPlacePickerのAPIを使用することによって、これを達成できる) -
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == ET_PLACE_PICKER_REQUEST)
{
if (resultCode == Activity.RESULT_OK)
{
final Place place = PlacePicker.getPlace(getContext(), data);
final CharSequence name = place.getName();
final CharSequence address = place.getAddress();
final String placeId = place.getId();
//Your Code
}
}}
出典
2017-03-05 06:15:47
sku