• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DataBufferUtils类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.android.gms.common.data.DataBufferUtils的典型用法代码示例。如果您正苦于以下问题:Java DataBufferUtils类的具体用法?Java DataBufferUtils怎么用?Java DataBufferUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DataBufferUtils类属于com.google.android.gms.common.data包,在下文中一共展示了DataBufferUtils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getAutocomplete

import com.google.android.gms.common.data.DataBufferUtils; //导入依赖的package包/类
private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
    if (mGoogleApiClient.isConnected()) {

        PendingResult<AutocompletePredictionBuffer> results =
                Places.GeoDataApi
                        .getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
                                mBounds, mPlaceFilter);

        AutocompletePredictionBuffer autocompletePredictions = results
                .await(60, TimeUnit.SECONDS);

        final Status status = autocompletePredictions.getStatus();
        if (!status.isSuccess()) {
            Toast.makeText(getContext(), "Error contacting API: " + status.toString(),
                    Toast.LENGTH_SHORT).show();
            autocompletePredictions.release();
            return null;
        }
        return DataBufferUtils.freezeAndClose(autocompletePredictions);
    }
    return null;
}
 
开发者ID:Mun0n,项目名称:MADBike,代码行数:23,代码来源:PlaceAutocompleteAdapter.java


示例2: getAutocomplete

import com.google.android.gms.common.data.DataBufferUtils; //导入依赖的package包/类
private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
  if (mGoogleApiClient.isConnected()) {
    PendingResult<AutocompletePredictionBuffer> results =
        Places.GeoDataApi.getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
            mBounds, mPlaceFilter);

    AutocompletePredictionBuffer autocompletePredictions = results.await(60, TimeUnit.SECONDS);

    final Status status = autocompletePredictions.getStatus();
    if (!status.isSuccess()) {
      Toast.makeText(getContext(), "Error contacting API: " + status.toString(),
          Toast.LENGTH_SHORT).show();
      autocompletePredictions.release();
      return null;
    }

    return DataBufferUtils.freezeAndClose(autocompletePredictions);
  }
  return null;
}
 
开发者ID:jotaramirez90,项目名称:AutocompleteLocation,代码行数:21,代码来源:AutoCompleteAdapter.java


示例3: getAutocomplete

import com.google.android.gms.common.data.DataBufferUtils; //导入依赖的package包/类
private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
	if (mGoogleApiClient.isConnected()) {
		PendingResult<AutocompletePredictionBuffer> results =
                  Places.GeoDataApi
			.getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
										mBounds, mPlaceFilter);
 				AutocompletePredictionBuffer autocompletePredictions = results
                  .await(60, TimeUnit.SECONDS);
				final Status status = autocompletePredictions.getStatus();
		if (!status.isSuccess()) {
			if (callback != null) callback.onSuggestFail(status);
			autocompletePredictions.release();
			return null;
		}
			return DataBufferUtils.freezeAndClose(autocompletePredictions);
	}
		return null;
}
 
开发者ID:agusibrahim,项目名称:go-jay,代码行数:19,代码来源:PlaceAutoCompleteHelper.java


示例4: getAutocomplete

import com.google.android.gms.common.data.DataBufferUtils; //导入依赖的package包/类
/**
 * Submits an autocomplete query to the Places Geo Data Autocomplete API.
 * Results are returned as frozen AutocompletePrediction objects, ready to be cached.
 * objects to store the Place ID and description that the API returns.
 * Returns an empty list if no results were found.
 * Returns null if the API client is not available or the query did not complete
 * successfully.
 * This method MUST be called off the main UI thread, as it will block until data is returned
 * from the API, which may include a network request.
 *
 * @param constraint Autocomplete query string
 * @return Results from the autocomplete API or null if the query was not successful.
 * @see Places#GEO_DATA_API#getAutocomplete(CharSequence)
 * @see AutocompletePrediction#freeze()
 */
private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
    if (mGoogleApiClient.isConnected()) {
        Log.i(TAG, "Starting autocomplete query for: " + constraint);

        // Submit the query to the autocomplete API and retrieve a PendingResult that will
        // contain the results when the query completes.
        PendingResult<AutocompletePredictionBuffer> results =
                Places.GeoDataApi
                        .getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
                                mBounds, mPlaceFilter);

        // This method should have been called off the main UI thread. Block and wait for at most 60s
        // for a result from the API.
        AutocompletePredictionBuffer autocompletePredictions = results
                .await(60, TimeUnit.SECONDS);

        // Confirm that the query completed successfully, otherwise return null
        final Status status = autocompletePredictions.getStatus();
        if (!status.isSuccess()) {
            Toast.makeText(getContext(), "Error contacting API: " + status.toString(),
                    Toast.LENGTH_SHORT).show();
            Log.e(TAG, "Error getting autocomplete prediction API call: " + status.toString());
            autocompletePredictions.release();
            return null;
        }

        Log.i(TAG, "Query completed. Received " + autocompletePredictions.getCount()
                + " predictions.");

        // Freeze the results immutable representation that can be stored safely.
        return DataBufferUtils.freezeAndClose(autocompletePredictions);
    }
    Log.e(TAG, "Google API client is not connected for autocomplete query.");
    return null;
}
 
开发者ID:codemybrainsout,项目名称:place-search-dialog,代码行数:51,代码来源:PlaceAutocompleteAdapter.java


示例5: getAutocomplete

import com.google.android.gms.common.data.DataBufferUtils; //导入依赖的package包/类
/**
     * Submits an autocomplete query to the Places Geo Data Autocomplete API.
     * Results are returned as frozen AutocompletePrediction objects, ready to be cached.
     * objects to store the Place ID and description that the API returns.
     * Returns an empty list if no results were found.
     * Returns null if the API client is not available or the query did not statusComplete
     * successfully.
     * This method MUST be called off the main UI thread, as it will block until data is returned
     * from the API, which may include a network request.
     *
     * @param constraint Autocomplete query string
     * @return Results from the autocomplete API or null if the query was not successful.
     * @see Places#GEO_DATA_API#getAutocomplete(CharSequence)
     * @see AutocompletePrediction#freeze()
     */
    private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
        if (mGoogleApiClient.isConnected()) {
//
//            constraint = constraint  + " " +mConstraint;
            // Submit the query to the autocomplete API and retrieve a PendingResult that will
            // contain the results when the query completes.
            PendingResult<AutocompletePredictionBuffer> results =
                    Places.GeoDataApi
                            .getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
                                    mBounds, mPlaceFilter);
            // This method should have been called off the main UI thread. Block and wait for at most 60s
            // for a result from the API.
            AutocompletePredictionBuffer autocompletePredictions = results
                    .await(60, TimeUnit.SECONDS);

            // Confirm that the query completed successfully, otherwise return null
            final Status status = autocompletePredictions.getStatus();
            if (!status.isSuccess()) {
                Toast.makeText(getContext(), "Check your internet connection", Toast.LENGTH_SHORT).show();
                autocompletePredictions.release();
                return null;
            }


            // Freeze the results immutable representation that can be stored safely.
            return DataBufferUtils.freezeAndClose(autocompletePredictions);
        }
        return null;
    }
 
开发者ID:blessingoraz,项目名称:Akwukwo,代码行数:45,代码来源:PlaceAutocompleteAdapter.java


示例6: getAutocomplete

import com.google.android.gms.common.data.DataBufferUtils; //导入依赖的package包/类
/**
 * Submits an autocomplete query to the Places Geo Data Autocomplete API.
 * Results are returned as frozen AutocompletePrediction objects, ready to be cached.
 * objects to store the Place ID and description that the API returns.
 * Returns an empty list if no results were found.
 * Returns null if the API client is not available or the query did not complete
 * successfully.
 * This method MUST be called off the main UI thread, as it will block until data is returned
 * from the API, which may include a network request.
 *
 * @param constraint Autocomplete query string
 * @return Results from the autocomplete API or null if the query was not successful.
 * @see Places#GEO_DATA_API#getAutocomplete(CharSequence)
 * @see AutocompletePrediction#freeze()
 */
private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
    if (mGoogleApiClient.isConnected()) {

        // Submit the query to the autocomplete API and retrieve a PendingResult that will
        // contain the results when the query completes.
        PendingResult<AutocompletePredictionBuffer> results =
                Places.GeoDataApi
                        .getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
                                mBounds, mPlaceFilter);

        // This method should have been called off the main UI thread. Block and wait for at most 60s
        // for a result from the API.
        AutocompletePredictionBuffer autocompletePredictions = results
                .await(60, TimeUnit.SECONDS);

        // Confirm that the query completed successfully, otherwise return null
        final Status status = autocompletePredictions.getStatus();
        if (!status.isSuccess()) {
            Toast.makeText(getContext(), "Error contacting API: " + status.toString(),
                    Toast.LENGTH_SHORT).show();
            autocompletePredictions.release();
            return null;
        }


        // Freeze the results immutable representation that can be stored safely.
        return DataBufferUtils.freezeAndClose(autocompletePredictions);
    }
    return null;
}
 
开发者ID:David-Hackro,项目名称:ExamplesAndroid,代码行数:46,代码来源:PlaceAutocompleteAdapter.java


示例7: getAutocomplete

import com.google.android.gms.common.data.DataBufferUtils; //导入依赖的package包/类
/**
     * Submits an autocomplete query to the Places Geo Data Autocomplete API.
     * Results are returned as frozen AutocompletePrediction objects, ready to be cached.
     * objects to store the Place ID and description that the API returns.
     * Returns an empty list if no results were found.
     * Returns null if the API client is not available or the query did not complete
     * successfully.
     * This method MUST be called off the main UI thread, as it will block until data is returned
     * from the API, which may include a network request.
     *
     * @param constraint Autocomplete query string
     * @return Results from the autocomplete API or null if the query was not successful.
     * @see Places#GEO_DATA_API#getAutocomplete(CharSequence)
     * @see AutocompletePrediction#freeze()
     */
    private ArrayList<AutocompletePrediction> getAutocomplete(CharSequence constraint) {
        if (mGoogleApiClient.isConnected()) {
//            Log.i(TAG, "Starting autocomplete query for: " + constraint);

            // Submit the query to the autocomplete API and retrieve a PendingResult that will
            // contain the results when the query completes.
            PendingResult<AutocompletePredictionBuffer> results =
                    Places.GeoDataApi
                            .getAutocompletePredictions(mGoogleApiClient, constraint.toString(),
                                    mBounds, mPlaceFilter);

            // This method should have been called off the main UI thread. Block and wait for at most 60s
            // for a result from the API.
            AutocompletePredictionBuffer autocompletePredictions = results
                    .await(60, TimeUnit.SECONDS);

            // Confirm that the query completed successfully, otherwise return null
            final Status status = autocompletePredictions.getStatus();
            if (!status.isSuccess()) {
                Toast.makeText(getContext(), "Error contacting API: " + status.toString(),
                        Toast.LENGTH_SHORT).show();
//                Log.e(TAG, "Error getting autocomplete prediction API call: " + status.toString());
                autocompletePredictions.release();
                return null;
            }

//            Log.i(TAG, "Query completed. Received " + autocompletePredictions.getCount()
//                    + " predictions.");

            // Freeze the results immutable representation that can be stored safely.
            return DataBufferUtils.freezeAndClose(autocompletePredictions);
        }
//        Log.e(TAG, "Google API client is not connected for autocomplete query.");
        return null;
    }
 
开发者ID:nogalavi,项目名称:Bikeable,代码行数:51,代码来源:PlaceAutocompleteAdapter.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RuntimeAttributePropertyInfo类代码示例发布时间:2022-05-23
下一篇:
Java ModalLensGraphMouse类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap