当前位置: 首页>>代码示例>>Java>>正文


Java AutocompletePrediction.getPlaceId方法代码示例

本文整理汇总了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);
}
 
开发者ID:blessingoraz,项目名称:Akwukwo,代码行数:24,代码来源:SearchLocationActivity.java

示例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);
}
 
开发者ID:David-Hackro,项目名称:ExamplesAndroid,代码行数:26,代码来源:MainActivity.java

示例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);
}
 
开发者ID:googlesamples,项目名称:android-play-places,代码行数:25,代码来源:MainActivity.java

示例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);
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:11,代码来源:SearchActivity.java

示例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);
  }
}
 
开发者ID:jotaramirez90,项目名称:AutocompleteLocation,代码行数:11,代码来源:AutoCompleteLocation.java

示例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);
}
 
开发者ID:agusibrahim,项目名称:go-jay,代码行数:9,代码来源:PlaceAutoCompleteHelper.java

示例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);
}
 
开发者ID:codemybrainsout,项目名称:place-search-dialog,代码行数:14,代码来源:PlaceSearchDialog.java

示例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();
}
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:16,代码来源:SearchHistoryCollector.java


注:本文中的com.google.android.gms.location.places.AutocompletePrediction.getPlaceId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。