本文整理汇总了Java中com.google.android.gms.location.places.AutocompletePrediction.getPlaceId方法的典型用法代码示例。如果您正苦于以下问题:Java AutocompletePrediction.getPlaceId方法的具体用法?Java AutocompletePrediction.getPlaceId怎么用?Java AutocompletePrediction.getPlaceId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.location.places.AutocompletePrediction
的用法示例。
在下文中一共展示了AutocompletePrediction.getPlaceId方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onItemClick
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
@Override
public void onItemClick (AdapterView<?> parent, View view, int position, long id) {
/*
Retrieve the place ID of the selected item from the Adapter.
The adapter stores each Place suggestion in a AutocompletePrediction from which we
read the place ID and title.
*/
final AutocompletePrediction item = mAdapter.getItem (position);
final String placeId = item.getPlaceId ();
final CharSequence primaryText = item.getPrimaryText (null);
Log.i("", "Autocomplete item selected: " + primaryText);
/*
Issue a request to the Places Geo Data API to retrieve a Place object with additional
details about the place.
*/
PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi
.getPlaceById (mGoogleApiClient, placeId);
placeResult.setResultCallback (mUpdatePlaceDetailsCallback);
Log.i("", "Called getPlaceById to get Place details for " + placeId);
mSearchLocation.setThreshold(1000);
}
示例2: onItemClick
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
/*
Retrieve the place ID of the selected item from the Adapter.
The adapter stores each Place suggestion in a AutocompletePrediction from which we
read the place ID and title.
*/
final AutocompletePrediction item = mAdapter.getItem(position);
final String placeId = item.getPlaceId();
final CharSequence primaryText = item.getPrimaryText(null);
Log.i(TAG, "Autocomplete item selected: " + primaryText);
/*
Issue a request to the Places Geo Data API to retrieve a Place object with additional
details about the place.
*/
PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi
.getPlaceById(mGoogleApiClient, placeId);
placeResult.setResultCallback(mUpdatePlaceDetailsCallback);
Toast.makeText(getApplicationContext(), "Clicked: " + primaryText,
Toast.LENGTH_SHORT).show();
Log.i(TAG, "Called getPlaceById to get Place details for " + placeId);
}
示例3: onItemClick
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
/*
Retrieve the place ID of the selected item from the Adapter.
The adapter stores each Place suggestion in a AutocompletePrediction from which we
read the place ID and title.
*/
final AutocompletePrediction item = mAdapter.getItem(position);
final String placeId = item.getPlaceId();
final CharSequence primaryText = item.getPrimaryText(null);
Log.i(TAG, "Autocomplete item selected: " + primaryText);
/*
Issue a request to the Places Geo Data Client to retrieve a Place object with
additional details about the place.
*/
Task<PlaceBufferResponse> placeResult = mGeoDataClient.getPlaceById(placeId);
placeResult.addOnCompleteListener(mUpdatePlaceDetailsCallback);
Toast.makeText(getApplicationContext(), "Clicked: " + primaryText,
Toast.LENGTH_SHORT).show();
Log.i(TAG, "Called getPlaceById to get Place details for " + placeId);
}
示例4: onItemClick
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
AnalyticsManager.getInstance().trackSearch();
final AutocompletePrediction item = mAdapter.getItem(position);
final String placeId = item.getPlaceId();
final CharSequence primaryText = item.getPrimaryText(null);
PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi
.getPlaceById(mGoogleApiClient, placeId);
placeResult.setResultCallback(mUpdatePlaceDetailsCallback);
}
示例5: onItemClick
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
@Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
UIUtils.hideKeyboard(AutoCompleteLocation.this.getContext(), AutoCompleteLocation.this);
final AutocompletePrediction item = mAutoCompleteAdapter.getItem(position);
if (item != null) {
final String placeId = item.getPlaceId();
PendingResult<PlaceBuffer> placeResult =
Places.GeoDataApi.getPlaceById(mGoogleApiClient, placeId);
placeResult.setResultCallback(mUpdatePlaceDetailsCallback);
}
}
示例6: onItemClick
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final AutocompletePrediction item = mAdapter.getItem(position);
final String placeId = item.getPlaceId();
PendingResult<PlaceBuffer> placeResult = Places.GeoDataApi
.getPlaceById(mGoogleApiClient, placeId);
placeResult.setResultCallback(mUpdatePlaceDetailsCallback);
}
示例7: onItemClick
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
final AutocompletePrediction item = mAdapter.getItem(position);
final String placeId = item.getPlaceId();
final CharSequence primaryText = item.getPrimaryText(null);
//Hide Keyboard
InputMethodManager in = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
in.hideSoftInputFromWindow(view.getWindowToken(), 0);
Log.i(TAG, "Autocomplete item selected: " + primaryText);
}
示例8: addPredictionToHistory
import com.google.android.gms.location.places.AutocompletePrediction; //导入方法依赖的package包/类
public void addPredictionToHistory(AutocompletePrediction prediction){
// will be used after search
if (prediction == null || prediction.getPlaceId() == null){
return;
}
boolean isInHistory = isPredictionInOnlineHistory(prediction);
if (isInHistory) {
return;
}
addPredictionToOnlineHistory(prediction);
updateToOfflineHistory();
}